mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Allow _.template functions to be called with no arguments.
This change simply allows templates to be called with no arguments, for a behaviour equivalent to being called with an empty object, {}.
This commit is contained in:
@@ -625,7 +625,7 @@
|
||||
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);};' +
|
||||
'with(obj){p.push(\'' +
|
||||
'with(obj||{}){p.push(\'' +
|
||||
str.replace(/[\r\t\n]/g, " ")
|
||||
.replace(endMatch,"\t")
|
||||
.split("'").join("\\'")
|
||||
|
||||
Reference in New Issue
Block a user