# @75lb/deep-merge

> Deep-merge the values of one object structure into another

Latest version **1.1.4** (published 2026-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @75lb/deep-merge
pnpm add @75lb/deep-merge
yarn add @75lb/deep-merge
bun add @75lb/deep-merge
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2026-05-13 |
| First published | 2021-06-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12.17 |
| Dependencies | 2 |
| Unpacked size | 52.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Lloyd Brookes |
| Maintainers | 75lb |
| Keywords | merge, deep merge, array, object, merge, options |

## Links

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

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [typical](https://npm.io/package/typical.md) ^7.1.1

## Recent versions

- 1.1.4 (latest) — 2026-05-13
- 1.1.3 — 2026-03-07
- 1.1.2 — 2024-07-31
- 1.1.1 — 2021-09-05
- 1.1.0 — 2021-08-18
- 1.0.0 — 2021-06-09

## README

[![view on npm](https://badgen.net/npm/v/@75lb/deep-merge)](https://www.npmjs.org/package/@75lb/deep-merge)
[![npm module downloads](https://badgen.net/npm/dt/@75lb/deep-merge)](https://www.npmjs.org/package/@75lb/deep-merge)
[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/deep-merge)](https://github.com/75lb/deep-merge/network/dependents?dependent_type=REPOSITORY)
[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/deep-merge)](https://github.com/75lb/deep-merge/network/dependents?dependent_type=PACKAGE)
[![Node.js CI](https://github.com/75lb/deep-merge/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/deep-merge/actions/workflows/node.js.yml)

# @75lb/deep-merge

Deep-merge the values of one object structure into another. Similar to [`Object.assign()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) except it processes the full depth of the object structure, not only the top level. Useful for merging config.

## Synopsis

```js
import deepMerge from '@75lb/deep-merge'

```

### Simple

Typical example merging four objects. Input:

```js
deepMerge(
  { port: 8000, data: { animal: 'cow' } },
  { stack: ['one'] },
  { stack: ['two'], help: true },
  { data: { animal: 'bat', metal: 'iron' } }
)
```

Result

```js
{
  port: 8000,
  stack: ['two'],
  help: true,
  data: { animal: 'bat', metal: 'iron' }
}
```

### Arrays

Empty arrays are ignored and not merged in. Input:

```js
deepMerge(
  { stack: ['one'] },
  { stack: [] }
)
```

Result:


```js
{ stack: ['one'] }
```

However, if the later array contains one or more values the later array will *replace* the original: 

```js
deepMerge(
  { stack: ['one'] },
  { stack: ['two'] }
)
```

Result:

```js
{ stack: ['two'] }
```

### Load anywhere

This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.

Within a Node.js ECMAScript Module:

```js
import deepMerge from '@75lb/deep-merge'
```

Within an modern browser ECMAScript Module:

```js
import deepMerge from './node_modules/@75lb/deep-merge/dist/index.mjs'
```

* * *

&copy; 2018-26 [Lloyd Brookes](https://github.com/75lb) \<opensource@75lb.com\>.

Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

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