1 # object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)
3 > ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)
8 Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari),
9 support `Object.assign()` :tada:. If you target only those environments, then by all
10 means, use `Object.assign()` instead of this package.
16 $ npm install --save object-assign
23 const objectAssign = require('object-assign');
25 objectAssign({foo: 0}, {bar: 1});
29 objectAssign({foo: 0}, {bar: 1}, {baz: 2});
30 //=> {foo: 0, bar: 1, baz: 2}
32 // overwrites equal keys
33 objectAssign({foo: 0}, {foo: 1}, {foo: 2});
36 // ignores null and undefined sources
37 objectAssign({foo: 0}, null, {bar: 1}, undefined);
44 ### objectAssign(target, [source, ...])
46 Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
51 - [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
56 - [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`
61 MIT © [Sindre Sorhus](https://sindresorhus.com)