From 6fb121e64c6509e968e0c2aa7fce8a507fe1d5db Mon Sep 17 00:00:00 2001 From: Lucas Galfaso Date: Wed, 21 May 2014 21:37:59 -0300 Subject: [PATCH] refactor(parse): simplify the Parser's filter function --- src/ng/parse.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/ng/parse.js b/src/ng/parse.js index 3b582735a08e..0fe7a247c2b1 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -542,21 +542,17 @@ Parser.prototype = { var token = this.expect(); var fn = this.$filter(token.text); var argsFn = []; - while (true) { - if ((token = this.expect(':'))) { - argsFn.push(this.expression()); - } else { - var fnInvoke = function(self, locals, input) { - var args = [input]; - for (var i = 0; i < argsFn.length; i++) { - args.push(argsFn[i](self, locals)); - } - return fn.apply(self, args); - }; - return function() { - return fnInvoke; - }; + while(this.expect(':')) { + argsFn.push(this.expression()); + } + return valueFn(fnInvoke); + + function fnInvoke(self, locals, input) { + var args = [input]; + for (var i = 0; i < argsFn.length; i++) { + args.push(argsFn[i](self, locals)); } + return fn.apply(self, args); } },