object-assign / 4.0.1 last updated 8 months ago created on Feb 2nd 2014

Install

npm install --save object-assign

Clone

git clone git@github.com:sindresorhus/object-assign.git

dependencies

No dependencies listed.

maintainers

sindresorhus sindresorhus

versions 15 total

4.0.1 8 months ago sindresorhus
4.0.0 8 months ago sindresorhus
3.0.0 10 months ago sindresorhus
2.1.1 10 months ago sindresorhus
2.0.0 a year ago sindresorhus
1.0.0 2 years ago sindresorhus
0.4.0 2 years ago sindresorhus
0.3.1 2 years ago sindresorhus
0.3.0 2 years ago sindresorhus
0.2.2 2 years ago sindresorhus
0.2.1 2 years ago sindresorhus
0.2.0 2 years ago sindresorhus
0.1.2 2 years ago sindresorhus
0.1.1 2 years ago sindresorhus
0.1.0 2 years ago sindresorhus
615618 Downloads yesterday.

readme

object-assign Build Status

ES6 Object.assign() ponyfill

Ponyfill: A polyfill that doesn't overwrite the native method

Install

$ npm install --save object-assign

Usage

var objectAssign = require('object-assign');

objectAssign({foo: 0}, {bar: 1});
//=> {foo: 0, bar: 1}

// multiple sources
objectAssign({foo: 0}, {bar: 1}, {baz: 2});
//=> {foo: 0, bar: 1, baz: 2}

// overwrites equal keys
objectAssign({foo: 0}, {foo: 1}, {foo: 2});
//=> {foo: 2}

// ignores null and undefined sources
objectAssign({foo: 0}, null, {bar: 1}, undefined);
//=> {foo: 0, bar: 1}

API

objectAssign(target, source, [source, ...])

Assigns enumerable own properties of source objects to the target object and returns the target object. Additional source objects will overwrite previous ones.

Resources

License

MIT © Sindre Sorhus

Resolving all dependencies.. This could take a while as our cache is not yet fully warmed up.