1 # object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)
3 > ES6 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill
5 > Ponyfill: A polyfill that doesn't overwrite the native method
11 $ npm install --save object-assign
18 var objectAssign = require('object-assign');
20 objectAssign({foo: 0}, {bar: 1});
24 objectAssign({foo: 0}, {bar: 1}, {baz: 2});
25 //=> {foo: 0, bar: 1, baz: 2}
27 // overwrites equal keys
28 objectAssign({foo: 0}, {foo: 1}, {foo: 2});
31 // ignores null and undefined sources
32 objectAssign({foo: 0}, null, {bar: 1}, undefined);
39 ### objectAssign(target, source, [source, ...])
41 Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
46 - [ES6 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
51 MIT © [Sindre Sorhus](http://sindresorhus.com)