global.__proto__ = forwarder(global.__proto__);
console.log([hello, my, name, is, bob, weeeee])
function forwarder(target){
var traps = {
getOwnPropertyDescriptor: Object.getOwnPropertyDescriptor.bind(null, target),
getOwnPropertyNames: Object.getOwnPropertyNames.bind(null, target),
keys: Object.keys.bind(null, target),
defineProperty: Object.defineProperty.bind(null, target),
get: function(r,k){ return target[k] },
set: function(r,k,v){ target[k] = v; return true },
has: function(k){ return k in target },
hasOwn: function(k){ return {}.hasOwnProperty.call(target, k) },
delete: function(k){ delete target[k]; return true },
enumerate: function(){ var i=0,k=[]; for (k[i++] in target); return k }
};
var names = {
get: 1,
set: 1,
has: 0,
hasOwn: 0,
delete: 0,
defineProperty: 0,
getOwnPropertyDescriptor: 0
}
return Proxy.create(Proxy.create({
get: function(r, trap){
return function(a, b){
if (trap in names)
console.log(trap, arguments[names[trap]])
else
console.log(trap);
if (trap === 'get' && !target[b]);
return b;
if (trap in traps)
return traps[trap].apply(target, arguments);
}
}
}), Object.getPrototypeOf(target));
}