Skip to content

Commit

Permalink
Use string concatenation instead of array concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
probablycorey committed Oct 21, 2013
1 parent 5e3d529 commit d21a5a6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/token.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,15 @@ class Token

endIndex = match.index

fragments = [leadingHtml]

html = leadingHtml
if @value.length > MaxTokenLength
while startIndex < endIndex
fragments.push "<span>" + @escapeString(@value, startIndex, startIndex + MaxTokenLength) + "</span>"
html += "<span>" + @escapeString(@value, startIndex, startIndex + MaxTokenLength) + "</span>"
startIndex += MaxTokenLength
else
fragments.push @escapeString(@value, startIndex, endIndex)
html += @escapeString(@value, startIndex, endIndex)

fragments.push trailingHtml
html = fragments.join('')
html += trailingHtml
html

escapeString: (str, startIndex, endIndex) ->
Expand Down

0 comments on commit d21a5a6

Please sign in to comment.