diff options
Diffstat (limited to 'lib/utils.js')
-rw-r--r-- | lib/utils.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/utils.js b/lib/utils.js index d4d28348..ca4b2d4b 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -115,7 +115,7 @@ function return_true() { return true; } function return_this() { return this; } function return_null() { return null; } -var MAP = (function(){ +var MAP = (function() { function MAP(a, f, backwards) { var ret = [], top = [], i; function doit() { @@ -138,7 +138,7 @@ var MAP = (function(){ } } return is_last; - }; + } if (Array.isArray(a)) { if (backwards) { for (i = a.length; --i >= 0;) if (doit()) break; @@ -152,14 +152,14 @@ var MAP = (function(){ for (i in a) if (HOP(a, i)) if (doit()) break; } return top.concat(ret); - }; + } MAP.at_top = function(val) { return new AtTop(val) }; MAP.splice = function(val) { return new Splice(val) }; MAP.last = function(val) { return new Last(val) }; var skip = MAP.skip = {}; - function AtTop(val) { this.v = val }; - function Splice(val) { this.v = val }; - function Last(val) { this.v = val }; + function AtTop(val) { this.v = val } + function Splice(val) { this.v = val } + function Last(val) { this.v = val } return MAP; })(); @@ -169,7 +169,7 @@ function push_uniq(array, el) { } function string_template(text, props) { - return text.replace(/\{(.+?)\}/g, function(str, p){ + return text.replace(/\{(.+?)\}/g, function(str, p) { return props && props[p]; }); } |