# object-assign

> ES2015 `Object.assign()` ponyfill

Latest version **4.1.1** (published 2017-01-16) · MIT license · 0 weekly downloads

> **Native alternative:** Object.assign — Use native JavaScript (Node 4.0.0+) (https://developer.mozilla.orgGlobal_Objects/Object/assign)

## Install

```sh
npm install object-assign
pnpm add object-assign
yarn add object-assign
bun add object-assign
```

## Health

**Score 38/100 (D)** — status: abandoned.

Positive: has types package; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.1.1 |
| Published | 2017-01-16 |
| First published | 2014-02-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/object-assign) |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 915 |
| Author | Sindre Sorhus |
| Maintainers | gaearon, sindresorhus, spicyj |
| Keywords | object, assign, extend, properties, es2015, ecmascript, harmony, ponyfill, prollyfill, polyfill, shim, browser |

## Links

- npm: https://www.npmjs.com/package/object-assign
- Repository: https://github.com/sindresorhus/object-assign
- Homepage: https://github.com/sindresorhus/object-assign#readme
- Issues: https://github.com/sindresorhus/object-assign/issues
- npm.io page: https://npm.io/package/object-assign

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 4.1.1 (latest) — 2017-01-16
- 4.1.0 — 2016-05-02
- 4.0.1 — 2015-08-20
- 4.0.0 — 2015-08-20
- 2.1.1 — 2015-06-05
- 3.0.0 — 2015-06-04
- 2.0.0 — 2014-11-22
- 1.0.0 — 2014-08-14
- 0.4.0 — 2014-08-13
- 0.3.1 — 2014-04-30
- 0.3.0 — 2014-04-11
- 0.2.2 — 2014-04-08
- 0.2.1 — 2014-03-24
- 0.2.0 — 2014-02-15
- 0.1.2 — 2014-02-04
- … 2 more at https://npm.io/package/object-assign/versions

## README

# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)

> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)


## 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

```js
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

- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)


## Related

- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)

---
_Source: https://npm.io/package/object-assign · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
