🌜
🌞
object-assign

object-assign

v4.1.1

ES2015 `Object.assign()` ponyfill

npm install object-assign

README

object-assign Build Status

ES2015 Object.assign() ponyfill

Use the built-in

Node.js 4 and up, as well as every evergreen browser (Chrome, Edge, Firefox, Opera, Safari), support Object.assign() :tada:. If you target only those environments, then by all means, use Object.assign() instead of this package.

Install

$ npm install --save object-assign

Usage

const 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, ...])

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

Release Notes

4.1.0
By Sophie Alpert • Published on May 2, 2016

Includes a feature test against buggy versions of V8 with incorrect enumeration order: 0c1671e15801cb98b557e2f3ed796772a9894793

General

License
MIT
Typescript Types
Tree-shakeable
No

Popularity

GitHub Stargazers
908
Community Interest
1,077
Number of Forks
80

Maintenance

Commits
10/219/2201
Last Commit
Jan 2, 2021
Open Issues
0
Closed Issues
0
Open Pull Requests
0
Closed Pull Requests
16

Versions

Versions Released
10/219/2201
Latest Version Released
Jan 16, 2017
Current Tags
latest4.1.1

Dependencies

Dependencies (0)
Dev Dependencies (4)

Contributors

sindresorhus
sindresorhus
Commits: 41
floatdrop
floatdrop
Commits: 3
jdalton
jdalton
Commits: 3
mxdubois
mxdubois
Commits: 2
sophiebits
sophiebits
Commits: 2
gaearon
gaearon
Commits: 1
bttmly
bttmly
Commits: 1
gyeates
gyeates
Commits: 1
stevemoser
stevemoser
Commits: 1
stevemao
stevemao
Commits: 1
chentsulin
chentsulin
Commits: 1
Richienb
Richienb
Commits: 1
BrassHead
BrassHead
Commits: 1