Merge pull request #60 from jonathanong/warn-context-overwrite
debug context: notify if a property is being overwritten
This commit is contained in:
commit
3c3b81b960
1 changed files with 3 additions and 0 deletions
|
@ -106,6 +106,9 @@ app.context = function(obj){
|
||||||
|
|
||||||
debug('context: %j', names);
|
debug('context: %j', names);
|
||||||
names.forEach(function(name){
|
names.forEach(function(name){
|
||||||
|
if (Object.getOwnPropertyDescriptor(ctx, name)) {
|
||||||
|
debug('context: overwriting %j', name);
|
||||||
|
}
|
||||||
var descriptor = Object.getOwnPropertyDescriptor(obj, name);
|
var descriptor = Object.getOwnPropertyDescriptor(obj, name);
|
||||||
Object.defineProperty(ctx, name, descriptor);
|
Object.defineProperty(ctx, name, descriptor);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue