Package Exports
- delegate-properties
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (delegate-properties) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
delegate-properties 
Copy properties from one object to another and make them non-enumerable, or make existing properties on an object non-enumerable.
Install
Install with npm
$ npm i delegate-properties --saveUsage
var delegate = require('delegate-properties');copy properties
Copy properties and make them non-enumerable
var provider = {
upper: function(val) {
return val.toUpperCase();
},
lower: function(val) {
return val.toLowerCase();
}
};
var receiver = {};
// an existing properties in the `receiver`
// object would be overwritten
delegate(receiver, provider);
receiver.upper('foo'), 'FOO');
receiver.lower('BAR'), 'bar');
console.log(receiver.upper('foo')); // 'FOO'
console.log(receiver.lower('BAR')); // 'bar'
// copied properties are non-enumerable
console.log(receiver); // {}
console.log(Object.keys(receiver)); // []make existing properties non-enumerable
var obj = {
upper: function(val) {
return val.toUpperCase();
},
lower: function(val) {
return val.toLowerCase();
}
};
delegate(obj);
console.log(obj) // {}
obj.upper('foo') // 'FOO'
obj.lower('BAR') // 'bar'Related projects
- define-property: Define a non-enumerable property on an object.
- delegate-object: Copy properties from an object to another object, where properties with function values will be… more
- forward-object: Copy properties from an object to another object, where properties with function values will be… more
- mixin-deep: Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone.
- mixin-object: Mixin the own and inherited properties of other objects onto the first object. Pass an… more
Running tests
Install dev dependencies:
$ npm i -d && npm testContributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on August 12, 2015.