# assign-deep

> Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects to a target object. Returns the target object.

Latest version **1.0.1** (published 2019-06-19) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-06-19 |
| First published | 2015-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 78 |
| Author | Jon Schlinkert |
| Maintainers | doowb, jonschlinkert |
| Keywords | assign, copy, deep, extend, key, keys, merge, mixin, object, prop, properties, values |

## Links

- npm: https://www.npmjs.com/package/assign-deep
- Repository: https://github.com/jonschlinkert/assign-deep
- Issues: https://github.com/jonschlinkert/assign-deep/issues
- npm.io page: https://npm.io/package/assign-deep

## Dependencies (1)

- [assign-symbols](https://npm.io/package/assign-symbols.md) ^2.0.2

## Recent versions

- 1.0.1 (latest) — 2019-06-19
- 0.4.8 (patch) — 2019-06-25
- 1.0.0 — 2018-08-07
- 0.4.7 — 2018-02-07
- 0.4.6 — 2017-08-04
- 0.4.5 — 2016-04-04
- 0.4.4 — 2016-03-11
- 0.4.3 — 2015-12-17
- 0.4.2 — 2015-11-06
- 0.4.1 — 2015-11-06
- 0.4.0 — 2015-11-06
- 0.3.1 — 2015-08-21
- 0.3.0 — 2015-06-29
- 0.1.2 — 2015-05-28
- 0.1.0 — 2015-02-25

## README

# assign-deep [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/assign-deep.svg?style=flat)](https://www.npmjs.com/package/assign-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/assign-deep.svg?style=flat)](https://npmjs.org/package/assign-deep) [![NPM total downloads](https://img.shields.io/npm/dt/assign-deep.svg?style=flat)](https://npmjs.org/package/assign-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/assign-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/assign-deep)

> Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects to a target object. Returns the target object.

Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save assign-deep
```

## Heads up!

[Please update](https://github.com/update/update) to version 1.0.1 or later, a critical bug was fixed in that version.

## Behavior

* This follows the same behavior as [Object.assign()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign), and thus _does not_ deep clone values.
* The first argument is the "target" object.
* To shallow clone, pass an empty object as the first argument.
* One or more additional ("source") objects may be passed.
* When multiple objects are passed, properties in _later_ objects will overwrite same-named properties in _earlier_ objects. Thus, properties in the target object will be overwritten by same-named properties in other objects.
* Only enumerable and own properties are copied.
* String and Symbol properties are copied.
* Sparse arguments are skipped, so this does not throw on `null` or `undefined` source values.
* Like [Object.assign()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign), `[[Get]]` is used on source objects and `[[Set]]` is used on the target, so it will invoke getters and setters. Therefore it assigns properties versus just copying or defining new properties. _Note that this should not be used for merging new properties into a prototype if the merge sources contain getters and you do not want `[[Get]]` to be used on the getters. For copying property definitions and their enumerability into prototypes `Object.getOwnPropertyDescriptor()` and `Object.defineProperty()` should be used instead._

## Usage

```js
const assign = require('assign-deep');

const config = {
  admin: true,
  author: {
    name: { first: 'Joe' }
  }
};

const locals = {
  admin: false,
  author: {
    name: { last: 'Smith' },
    username: 'joesmith'
  }
};

console.log(assign(config, locals));
// {
//   admin: false,
//   author: {
//     name: { first: 'Joe', last: 'Smith' },
//     username: 'joesmith'
//   }
// }
```

## About

<details>
<summary><strong>Contributing</strong></summary>

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

</details>

<details>
<summary><strong>Running Tests</strong></summary>

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

</details>

<details>
<summary><strong>Building docs</strong></summary>

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

</details>

### Related projects

You might also be interested in these projects:

* [assign-symbols](https://www.npmjs.com/package/assign-symbols): Assign the enumerable es6 Symbol properties from one or more objects to the first object… [more](https://github.com/jonschlinkert/assign-symbols) | [homepage](https://github.com/jonschlinkert/assign-symbols "Assign the enumerable es6 Symbol properties from one or more objects to the first object passed on the arguments. Can be used as a supplement to other extend, assign or merge methods as a polyfill for the Symbols part of the es6 Object.assign method.")
* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone… [more](https://github.com/jonschlinkert/mixin-deep) | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. No dependencies.")

### Contributors

| **Commits** | **Contributor** |  
| --- | --- |  
| 31 | [jonschlinkert](https://github.com/jonschlinkert) |  
| 14 | [doowb](https://github.com/doowb) |  

### Author

**Jon Schlinkert**

* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)

### License

Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on June 19, 2019._

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