Skip to content

Commit

Permalink
Remove extra string concatenation logic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kemitchell committed Sep 2, 2015
1 parent fbc1f93 commit 77ca79b
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions form.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var resolveElement = require('./element')

module.exports = function(form, values, numberings, headings) {
form.content = form.content
// resolve content
.map(function(element, index) {
var numbering = (
( numberings &&
Expand All @@ -11,19 +10,4 @@ module.exports = function(form, values, numberings, headings) {
numberings.content[index] : null )
return resolveElement(element, values, numbering, headings) })

// Concatenate contiguous strings.
.reduce(
function(content, element, index) {
var count = content.length
var last = content[count - 1]
if (
index > 0 &&
typeof element === 'string' &&
typeof last === 'string')
{ content[count - 1] = last + element }
else {
content.push(element) }
return content },
[])

return form }

0 comments on commit 77ca79b

Please sign in to comment.