mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
slight speedup to _.template
This commit is contained in:
@@ -630,7 +630,7 @@
|
||||
var c = _.templateSettings;
|
||||
var endMatch = new RegExp("'(?=[^"+c.end.substr(0, 1)+"]*"+escapeRegExp(c.end)+")","g");
|
||||
var fn = new Function('obj',
|
||||
'var p=[],print=function(){p.push.apply(p,arguments);};' +
|
||||
'var p=[];' +
|
||||
'with(obj||{}){p.push(\'' +
|
||||
str.replace(/\r/g, '\\r')
|
||||
.replace(/\n/g, '\\n')
|
||||
@@ -638,7 +638,7 @@
|
||||
.replace(endMatch,"✄")
|
||||
.split("'").join("\\'")
|
||||
.split("✄").join("'")
|
||||
.replace(c.interpolate, "',$1,'")
|
||||
.replace(c.interpolate, "' + $1 + '")
|
||||
.split(c.start).join("');")
|
||||
.split(c.end).join("p.push('")
|
||||
+ "');}return p.join('');");
|
||||
|
||||
Reference in New Issue
Block a user