deepmerge
Deeply merges the enumerable properties of two or more JavaScript objects into a new object
Repository Health
Technical Analysis
deepmerge is a small JavaScript utility that recursively merges the enumerable properties of two or more objects, returning a new merged object without mutating either input. Where a key exists in both objects, the value from the later object wins; nested objects are merged recursively rather than overwritten, and arrays are concatenated by default (with a fully customizable merge strategy).
The library exposes both a merge(x, y, options) function for two objects and a merge.all(arrayOfObjects, options) helper for combining any number of objects at once. Its behavior is highly configurable via an arrayMerge function (to overwrite, concatenate, or index-combine arrays), an isMergeableObject predicate (to control which values get deep-merged vs. copied as-is), and a customMerge function (to override merge behavior per property key) — all while remaining a tiny, dependency-free UMD bundle usable in Node.js or directly in the browser.
What You Get
- A
merge(x, y, [options])function that deeply combines two objects into a new, non-mutated result - A
merge.all(arrayOfObjects, [options])helper for merging any number of objects in one call - Configurable array-merge strategy (
arrayMergeoption) — concatenate, overwrite, or index-combine arrays, or supply a fully custom function - An
isMergeableObjectoption to control which values are deep-merged versus copied wholesale (useful for class instances or special objects) - A
customMergeoption to override merge behavior for specific property keys - A tiny UMD bundle (~723 bytes minified+gzipped) usable via CommonJS, or directly in the browser without a bundler
Common Use Cases
- Merging default configuration objects with user-supplied overrides while preserving nested defaults
- Combining multiple partial state or options objects into a single object in application or library code
- Merging JSON configuration files (e.g. environment-specific config layered over base config)
- Building plugin or middleware systems where each layer contributes partial configuration that must be deeply combined
Under The Hood
Architecture - deepmerge is implemented as a single, compact index.js (~106 lines) exporting a recursive merge function plus a merge.all wrapper; the core algorithm walks the target and source objects’ keys, recursively merging nested mergeable objects and delegating array handling to a pluggable arrayMerge strategy function, with cloneUnlessOtherwiseSpecified ensuring untouched values are still cloned to avoid mutating inputs. Tech Stack - Plain JavaScript (with a small TypeScript declaration file, index.d.ts) built and bundled via Rollup into a UMD module, with zero runtime dependencies, making it safe to use in both Node.js and browser contexts without a build step. Code Quality - The test/ directory covers custom array-merge strategies, custom isMergeableObject predicates, merge.all, and — notably — a dedicated prototype-poisoning.js test guarding against __proto__-based prototype pollution attacks, a security-conscious addition given how widely the library is used to merge untrusted input; despite no commits since 2023, the codebase is stable and the API has not needed to change. API Design - The API is minimal and predictable (merge, merge.all, plus three well-documented options), with clear semantics (later value wins, arrays concatenate by default, nested objects merge recursively) that make it a near drop-in replacement wherever Object.assign-style shallow merging falls short.
Used by 23 apps in this directory
NocoBase
Low Code Platforms · No Code Platforms
Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.
OpenPanel
Devops · Hosting Control Panel
Docker-powered web hosting control panel that gives every user a fully isolated environment with dedicated web server, database, and networking — VPS-grade security on shared hardware.
Payload CMS
Blogging · CMS · Developer Tools
The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.
Plasmic
CMS · Design Tools · Low Code Platforms
The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.
Refly
AI Development · Automation · No Code Platforms
Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.
Rill
Analytics · Data Engineering
The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.
Silex
Design Tools · No Code Platforms
Free, open-source visual website builder that exports clean HTML/CSS — no lock-in, no subscription, host anywhere
swagger-ui
Developer Tools
Transform OpenAPI specifications into interactive, browser-based API documentation that developers and consumers can explore and test live.
Teable
Databases · No Code Platforms
A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.