File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
var ejs = require ( '..' ) ;
4
+ var path = require ( 'path' ) ;
4
5
5
- ejs . fileLoader = function ( n ) { return files [ n . replace ( / ^ \/ / , '' ) . replace ( / \. e j s $ / , ' ') ] ; } ;
6
+ ejs . fileLoader = function ( n ) { return files [ path . basename ( n , '. ejs' ) ] ; } ;
6
7
7
8
var loops = 10000 ;
8
9
var runs = 9 ; // min 4 for median
Original file line number Diff line number Diff line change @@ -572,7 +572,9 @@ Template.prototype = {
572
572
573
573
if ( ! this . source ) {
574
574
this . generateSource ( ) ;
575
- prepended += ' var __output = [], __append = __output.push.bind(__output);' + '\n' ;
575
+ prepended +=
576
+ ' var __output = "";\n' +
577
+ ' function __append(s) { if (s !== undefined && s !== null) __output += s }\n' ;
576
578
if ( opts . outputFunctionName ) {
577
579
prepended += ' var ' + opts . outputFunctionName + ' = __append;' + '\n' ;
578
580
}
@@ -591,7 +593,7 @@ Template.prototype = {
591
593
prepended += ' with (' + opts . localsName + ' || {}) {' + '\n' ;
592
594
appended += ' }' + '\n' ;
593
595
}
594
- appended += ' return __output.join("") ;' + '\n' ;
596
+ appended += ' return __output;' + '\n' ;
595
597
this . source = prepended + this . source + appended ;
596
598
}
597
599
You can’t perform that action at this time.
0 commit comments