feature: unshift and shift for scope, working on #15

This commit is contained in:
harttle
2016-10-25 18:14:07 +08:00
parent 6135028015
commit da1d28e02e
2 changed files with 19 additions and 1 deletions
+7 -1
View File
@@ -41,7 +41,13 @@ var Scope = {
pop: function() {
return this.scopes.pop();
},
unshift: function(ctx) {
if (!ctx) throw new Error('trying to push $(ctx) into scopes');
return this.scopes.unshift(ctx);
},
shift: function() {
return this.scopes.shift();
},
setPropertyByPath: function(obj, path, val) {
if (_.isString(path)) {
var paths = path.replace(/\[/g, '.').replace(/\]/g, '').split('.');