diff options
author | pabs@pablotron.org <pabs@pablotron.org> | 2014-12-18 23:13:44 -0500 |
---|---|---|
committer | pabs@pablotron.org <pabs@pablotron.org> | 2014-12-18 23:13:44 -0500 |
commit | c78c54225cc5e51482dfa2d6960372c6aff67ea6 (patch) | |
tree | ecfd14b8bf163a39ac54e3c030a721b446e46b59 | |
parent | 6c56e7cfb78059586f48c71f2cd2e9eddd422602 (diff) | |
download | luigi-template-c78c54225cc5e51482dfa2d6960372c6aff67ea6.tar.bz2 luigi-template-c78c54225cc5e51482dfa2d6960372c6aff67ea6.zip |
add support for custom filter ovveride to js implementation
-rw-r--r-- | js/luigi-template.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/js/luigi-template.js b/js/luigi-template.js index 925b811..5018b7b 100644 --- a/js/luigi-template.js +++ b/js/luigi-template.js @@ -238,8 +238,9 @@ LuigiTemplate = (function() { return r; } - function init(s) { + function init(s, filters) { this.s = s; + this.filters = filters || FILTERS; this.actions = parse_template(s); }; @@ -257,7 +258,7 @@ LuigiTemplate = (function() { throw new Error('missing key: ' + row.key) return reduce(row.filters, function(r, f) { - return FILTERS[f.name](r, f.args, o, this); + return this.filters[f.name](r, f.args, o, this); }, o[row.key]); } else { /* never reached */ @@ -334,8 +335,8 @@ LuigiTemplate = (function() { T.VERSION = VERSION; // add singleton run - T.run = function(s, o) { - return new T(s).run(o); + T.run = function(s, o, f) { + return new T(s, f).run(o); } // expose interface |