# @ianwalter/merge

> Recursively merge JavaScript Objects

Latest version **9.0.1** (published 2020-06-10) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install @ianwalter/merge
pnpm add @ianwalter/merge
yarn add @ianwalter/merge
bun add @ianwalter/merge
```

## Health

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

Positive: esm support.

Warnings: low downloads; no types; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 9.0.1 |
| Published | 2020-06-10 |
| First published | 2019-01-18 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 1 |
| Install scripts | no |
| Author | Ian Walter |
| Maintainers | ianwalter |
| Keywords | merge, object, array, assign, recursive |

## Links

- npm: https://www.npmjs.com/package/@ianwalter/merge
- Repository: https://github.com/ianwalter/merge
- Homepage: https://github.com/ianwalter/merge#readme
- Issues: https://github.com/ianwalter/merge/issues
- npm.io page: https://npm.io/package/@ianwalter/merge

## Recent versions

- 9.0.1 (latest) — 2020-06-10
- 9.0.0 — 2020-06-10
- 9.0.0-4 — 2020-06-09
- 9.0.0-3 — 2020-06-09
- 9.0.0-2 — 2020-06-09
- 9.0.0-1 — 2020-06-09
- 9.0.0-0 — 2020-06-09
- 8.0.1 — 2020-06-08
- 8.0.0 — 2020-06-07
- 7.0.0 — 2020-02-22
- 6.0.0 — 2020-02-22
- 5.0.0 — 2019-06-27
- 4.0.0 — 2019-04-29
- 3.0.0 — 2019-04-03
- 2.0.1 — 2019-02-05
- … 4 more at https://npm.io/package/@ianwalter/merge/versions

## README

# @ianwalter/merge
> Recursively merge JavaScript Objects

[![npm page][npmImage]][npmUrl]
[![CI][ciImage]][ciUrl]

## About

Inspired by and created as an alternative for [deepmerge][deepmergeUrl].

## Usage

```js
import merge from '@ianwalter/merge'

const item1 = { id: 1, details: { name: 'Civilian', lists: ['Folk'] } }
const item3 = { id: 2, details: { plays: 2 } }
const item2 = { id: 3, details: { lists: ['Chill', 'Alt'] } }

merge(item1, item2, item3) //=> {
//    id: 3,
//    details: {
//      name: 'Civilian',
//      plays: 2,
//      lists: ['Chill', 'Alt']
//    }
//  }
```

## Note

Like `Object.assign`, `merge` will treat the first passed item as the
"destination" and mutate it. If you want a new "destination" object simply pass
an empty object `{}` as the first argument or you can always use
[@ianwalter/clone][cloneUrl] and clone the first argument beforehand. `merge`
will also merge prototype properties of objects so if you don't want that you
can also use `clone` to clone your objects before merging them since, with the
default options, `clone` does not clone prototype properties.

## Related

* [`@ianwalter/clone`][cloneUrl] - A configurable utility to clone JavaScript
data (Objects, Arrays, etc)

## License

Apache 2.0 with Commons Clause - See [LICENSE][licenseUrl]

&nbsp;

Created by [Ian Walter](https://ianwalter.dev)

[npmImage]: https://img.shields.io/npm/v/@ianwalter/merge.svg
[npmUrl]: https://www.npmjs.com/package/@ianwalter/merge
[ciImage]: https://github.com/ianwalter/merge/workflows/CI/badge.svg
[ciUrl]: https://github.com/ianwalter/merge/actions
[cloneUrl]: https://github.com/ianwalter/clone
[deepmergeUrl]: https://github.com/TehShrike/deepmerge
[licenseUrl]: https://github.com/ianwalter/merge/blob/master/LICENSE

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