aboutsummaryrefslogtreecommitdiff
path: root/luigi-template.js
diff options
context:
space:
mode:
Diffstat (limited to 'luigi-template.js')
-rw-r--r--luigi-template.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/luigi-template.js b/luigi-template.js
index 806ddea..0afa0d6 100644
--- a/luigi-template.js
+++ b/luigi-template.js
@@ -109,6 +109,25 @@ LuigiTemplate = (function() {
}
})();
+ // Array.reduce polyfill
+ var reduce = (function() {
+ if (Array.prototype.reduce) {
+ return function(a, fn, iv) {
+ return a.reduce(fn, iv);
+ };
+ } else {
+ return function(a, fn, iv) {
+ var r = iv;
+
+ each(a, function(v, i) {
+ r = fn(r, v, i, a);
+ });
+
+ return r;
+ };
+ }
+ })();
+
// String.scan polyfill
function scan(s, re, fn) {
var m;