mix2
The port of YUI3's mix method for node. Mixins two objects.
Install
$ npm install mix2
Usage
const a = a: 1const b = b: 2const c = a: 10 b: 20 c: 30 console // {a: 1, b: 2} // Will not override the existing property 'a' // {a: 1, b: 20, c: 30} // Only copy property 'a' and 'c', and override. // {a: 10, c: 30}
mix(receiver, supplier, [override], [copylist])
- receiver
Object
- supplier
Object
- override
Boolean=true
Whether should override the existing property ofreceiver
. Default to overriding(true
) - copylist
(Array.<String>)=
If specified, only mix the specific keys in the array. Otherwise, mixin all properties.
Extend the object receiver
with supplier
, and returns receiver
.
License
MIT