Merge pull request #60 from jonathanong/warn-context-overwrite

debug context: notify if a property is being overwritten
This commit is contained in:
Jonathan Ong 2013-10-25 03:49:23 -07:00
commit 3c3b81b960

View file

@ -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);
}); });