deepmerge

Deep object merging library for JavaScript. Recursively merges two or more objects, combining nested properties rather than overwriting them. Unlike Object.assign() or spread (...), deepmerge recurses into nested objects. Configurable merge behavior for arrays (concatenate vs overwrite) and custom merge functions. Widely used for merging configuration objects, combining default settings with user overrides, and merging Redux state.

Evaluated Mar 06, 2026 (0d ago) v4.x
Homepage ↗ Repo ↗ Developer Tools merge deep-merge object javascript typescript utilities config
⚙ Agent Friendliness
69
/ 100
Can an agent use this?
🔒 Security
99
/ 100
Is it safe for agents?
⚡ Reliability
94
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
90
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
95
Secret Handling
100

Pure utility library — no network surface. Prototype pollution risk if merging untrusted objects with __proto__ key — sanitize untrusted input before deepmerging.

⚡ Reliability

Uptime/SLA
98
Version Stability
95
Breaking Changes
95
Error Recovery
90
AF Security Reliability

Best When

You need to recursively merge plain JavaScript objects, especially for configuration merging where you want nested defaults preserved.

Avoid When

You have circular references, class instances with methods, or need only shallow merging (use Object.assign or spread).

Use Cases

  • Merge default configuration with user-provided overrides while preserving nested defaults not overridden
  • Combine multiple configuration sources (file, env, CLI args) with correct precedence and deep merging
  • Merge partial Redux state updates with existing state without losing non-updated nested properties
  • Deep clone objects by merging into an empty object: deepmerge({}, originalObject)
  • Combine API response objects from multiple sources when building aggregated data structures

Not For

  • Shallow merges — use Object.assign() or spread (...) for shallow one-level merges
  • Handling circular references — deepmerge will infinite loop on circular object references
  • JSON-serializable objects only — class instances, functions, and special objects may not merge correctly

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — utility library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Fully free, MIT licensed.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Arrays are concatenated by default — deepmerge(['a'], ['b']) produces ['a', 'b']; use arrayMerge option to override: arrayMerge: (dest, src) => src to replace instead
  • Circular references cause infinite recursion and stack overflow — deepmerge does not handle circular objects; use _.mergeWith with cycle detection for circular references
  • Class instances lose their prototype — merged objects are plain objects; methods from class instances are not preserved in the merge result
  • deepmerge creates new objects — both source and destination are unmodified; the return value is a new merged object
  • deepmerge.all([obj1, obj2, obj3]) merges multiple objects left-to-right — later objects override earlier ones for conflicting scalar values
  • Date, RegExp, Map, Set objects are not deep-merged — they're treated as primitives and overwritten; use a custom merge function for these types

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for deepmerge.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered