# mergify

> Merge objects deeply

Latest version **1.0.3** (published 2018-11-19) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install mergify
pnpm add mergify
yarn add mergify
bun add mergify
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-11-19 |
| First published | 2018-02-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 1 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Cyril Auburtin |
| Maintainers | caub |
| Keywords | object, assign, deep, merge, extend |

## Links

- npm: https://www.npmjs.com/package/mergify
- Repository: https://github.com/caub/mergify
- Homepage: https://github.com/caub/mergify#readme
- Issues: https://github.com/caub/mergify/issues
- npm.io page: https://npm.io/package/mergify

## Recent versions

- 1.0.3 (latest) — 2018-11-19
- 1.0.2 — 2018-05-22
- 1.0.1 — 2018-03-02
- 1.0.0 — 2018-02-17

## README

## Mergify
[![npm version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![coverage status][codecov-image]][codecov-url]


```js
const merge = require('mergify');

class D { constructor(o) { Object.assign(this, o); } }

merge(
	{a: {x: 1}, b: [2, 4], c: ['x'], d: new D({x: 5}), e: new Set([1, 3])}, 
	{a: {y: 1}, b: {1: 3}, c: ['y'], d: new D({y: 5}), e: new Set([2, 3])}
) 

// { a: {x: 1, y: 1}, b: [ 2, 3 ], c: ['x', 'y'], d: new D({y: 5}), e: new Set([1, 3, 2]) }
```
- merges plain objects deeply
- handles Sets and Maps (native ones or immutablesjs, with duck-typing)
- concatenates arrays
- works well with configurations, like webpack ones


Similar to lodash's mergeWith, but with some [nuances](test/index.spec.js) (search for 'lodash')

```js
const {mergeWith} = require('lodash');
const merge = (...o) => o.reduce((a, b) => 
	mergeWith(a, b, (a, b) => Array.isArray(a) && Array.isArray(b) ? [...a, ...b] : undefined)
);
```

[npm-image]: https://img.shields.io/npm/v/mergify.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/mergify
[travis-image]: https://img.shields.io/travis/caub/mergify.svg?style=flat-square
[travis-url]: https://travis-ci.org/caub/mergify
[codecov-image]: https://img.shields.io/codecov/c/github/caub/mergify.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/caub/mergify

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