Skip to content

Commit

Permalink
Replace array push/join with string concatenation
Browse files Browse the repository at this point in the history
Visit mde#344 for more details.
  • Loading branch information
bev-on authored Mar 1, 2018
1 parent 9f93d60 commit ad79b9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,12 @@ Template.prototype = {

if (!this.source) {
this.generateSource();
prepended += ' var __output = [], __append = __output.push.bind(__output);' + '\n';
prepended += ' var __output = "", __append = function (str) { __output += str; };' + '\n';
if (opts._with !== false) {
prepended += ' with (' + opts.localsName + ' || {}) {' + '\n';
appended += ' }' + '\n';
}
appended += ' return __output.join("");' + '\n';
appended += ' return __output;' + '\n';
this.source = prepended + this.source + appended;
}

Expand Down

0 comments on commit ad79b9c

Please sign in to comment.