aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2012-01-24 02:42:20 -0800
committerIgor Minar2012-01-25 16:52:39 -0800
commit8b32900d72313fd0e5b81068103d0a853f033d2a (patch)
tree21f031b620ce5424479c411757c9619ceae62108
parent18a1e860a3d50b04d7c0836ba7c6c0a0b96335be (diff)
downloadangular.js-8b32900d72313fd0e5b81068103d0a853f033d2a.tar.bz2
fix($parse): simplify getterFn
-rw-r--r--src/service/parse.js15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/service/parse.js b/src/service/parse.js
index f33aad0d..4958884f 100644
--- a/src/service/parse.js
+++ b/src/service/parse.js
@@ -693,17 +693,7 @@ function getter(obj, path, bindFnToScope) {
return obj;
}
-var getterFnCache = {},
- JS_KEYWORDS = {};
-
-forEach(
- ("abstract,boolean,break,byte,case,catch,char,class,const,continue,debugger,default," +
- "delete,do,double,else,enum,export,extends,false,final,finally,float,for,function,goto," +
- "if,implements,import,in,instanceof,int,interface,long,native,new,null,package,private," +
- "protected,public,return,short,static,super,switch,synchronized,this,throw,throws," +
- "transient,true,try,typeof,var,volatile,void,undefined,while,with").split(/,/),
- function(key){ JS_KEYWORDS[key] = true;}
-);
+var getterFnCache = {};
function getterFn(path) {
var fn = getterFnCache[path];
@@ -711,10 +701,9 @@ function getterFn(path) {
var code = 'var l, fn, p;\n';
forEach(path.split('.'), function(key) {
- key = (JS_KEYWORDS[key]) ? '["' + key + '"]' : '.' + key;
code += 'if(!s) return s;\n' +
'l=s;\n' +
- 's=s' + key + ';\n' +
+ 's=s' + '["' + key + '"]' + ';\n' +
'if (s && s.then) {\n' +
' if (!("$$v" in s)) {\n' +
' p=s;\n' +