debug: notify if a property is being overwritten

This commit is contained in:
Jonathan Ong 2013-10-05 12:56:36 -07:00
parent 4aa75a1164
commit df367e0749

View file

@ -106,6 +106,9 @@ app.context = function(obj){
debug('context: %j', names);
names.forEach(function(name){
if (Object.getOwnPropertyDescriptor(ctx, name)) {
debug('context: overwriting %j', name);
}
var descriptor = Object.getOwnPropertyDescriptor(obj, name);
Object.defineProperty(ctx, name, descriptor);
});