poor-mans-proxy-decorate-property
v1.0.1
Published
Decorate an Object's property for Proxy interception
Downloads
395
Readme
poor-mans-proxy-decorate-property
Decorate an Object's property for Proxy interception
Install
npm install poor-mans-proxy-decorate-property --save
Usage
var decorateProperty = require('poor-mans-proxy-decorate-property');
var target = {
name: 'Obj'
};
var proxy = {};
decorateProperty(proxy, target, {
get: function(target, prop, receiver) {
console.log(prop, 'accessed');
return target[prop];
}
}, 'name');
console.log(proxy.name);
// : name accessed
// : Obj
Test
npm install
npm test