Secure merge. Familiar contract.

@stackline/deepmerge

Immutable deep merge with prototype-pollution defenses, cycles, resource limits, accurate types, and zero runtime dependencies.

npm install @stackline/deepmerge

v1.0.0 Node 14.17+ TypeScript 3.9-7.0

Runs the production bundle

Merge playground

Unsafe keys

Target

JSON

Source

JSON

Result


            
Ready 0.000 ms Object.prototype unchanged

Lowest-change adoption

Keep existing imports

Install through an npm alias and code that imports deepmerge continues to work.

npm uninstall deepmerge
npm install deepmerge@npm:@stackline/deepmerge
import merge from 'deepmerge';

const config = merge(defaults, environment);

Public contract

One small API surface

Full reference
ExportPurposeAvailable in
merge(target, source, options?)Immutable recursive mergeESM, CJS, browser
merge.all(objects, options?)Merge a list from left to rightESM, CJS, browser
isMergeableObject(value)Default traversal predicateNamed and static export
UnsafeKeyErrorStrict unsafe-key rejectionNamed and static export
DeepMergeLimitErrorDepth or key budget exceededNamed and static export

Release evidence

Compatibility is tested, not implied

5,000
deterministic differential cases against deepmerge 4.3.1
100%
statement, line, and function coverage at release
3.9-7.0
TypeScript compatibility matrix
0
runtime dependencies