scope get all

This commit is contained in:
harttle
2016-06-26 13:16:34 +08:00
parent a482b4abe5
commit 82a6a72013
3 changed files with 18 additions and 4 deletions
+7
View File
@@ -4,9 +4,16 @@ const error = require('./error.js');
var scope = {
get: function(str) {
var ctx = {};
for (var i = this.scopes.length - 1; i >= 0; i--) {
if(str === undefined){
_.merge(ctx, this.scopes[i]);
}
var v = _.get(this.scopes[i], str);
if (v !== undefined) return v;
if(str === undefined){
return ctx;
}
}
},
set: function(k, v) {