Skip to content

Commit 77ca79b

Browse files
committed
Remove extra string concatenation logic
All non-string content objects are now passed through as some kind of object, so there's no longer any need to check whether resolving an object to a string creates contiguous strings.
1 parent fbc1f93 commit 77ca79b

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

form.js

-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ var resolveElement = require('./element')
22

33
module.exports = function(form, values, numberings, headings) {
44
form.content = form.content
5-
// resolve content
65
.map(function(element, index) {
76
var numbering = (
87
( numberings &&
@@ -11,19 +10,4 @@ module.exports = function(form, values, numberings, headings) {
1110
numberings.content[index] : null )
1211
return resolveElement(element, values, numbering, headings) })
1312

14-
// Concatenate contiguous strings.
15-
.reduce(
16-
function(content, element, index) {
17-
var count = content.length
18-
var last = content[count - 1]
19-
if (
20-
index > 0 &&
21-
typeof element === 'string' &&
22-
typeof last === 'string')
23-
{ content[count - 1] = last + element }
24-
else {
25-
content.push(element) }
26-
return content },
27-
[])
28-
2913
return form }

0 commit comments

Comments
 (0)