Extend the properties from any number of objects onto the first object. Pass an empty object as the first arg to create a new object.
MIT License
Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone.
Follow this project's author, Jon Schlinkert, for updates on this project and others.
Install with npm:
$ npm install --save mixin-object
If you only want to combine own-properties, use extend-shallow.
var mixin = require('mixin-object');
var obj = {c: 'c'};
var foo = mixin({a: 'a'}, {b: 'b'});
console.log(foo);
//=> {c: 'c', a: 'a', b: 'b'}
console.log(obj);
//=> {c: 'c'}
mixin({}, {a: 'a'}, {b: 'b'});
//=> {a: 'a', b: 'b'}
You might also be interested in these projects:
extend
but recursively copies only the missing properties/values to the target object. | homepage
Object
constructor. | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
$ npm install -g verbose/verb#dev verb-generate-readme && verb
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
$ npm install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT License.
This file was generated by verb-generate-readme, v0.6.0, on September 04, 2017.