Mergician
Mergician is a flexible, light-weight utility for deep (recursive) merging/cloning of JavaScript objects.
Why?
Unlike native methods and other merge/clone utilities, Mergician provides flexible options for customizing the merge process. These options make it easy to filter properties, inspect and modify properties before/after merging, merge and sort arrays, and remove duplicate array items. Property accessors and descriptors are also handled properly, ensuring that getter/setter functions are retained and descriptor values are defined on the newly merged object.
Features
- Deep merge/clone JavaScript objects
- Filter properties
- Inspect and modify properties
- Merge arrays
- Sort arrays
- Remove duplicate array items ("dedup")
- Properly handle property accessors (getters/setters) and descriptors
- Returns new object without modifying source objects (immutable)
Platform Support
Node 10+
Chrome 61+
Edge 16+
Firefox 60+
Safari 10.1+
Installation
NPM
npm install mergician
import mergician from 'mergician';
const mergician = require('mergician');
CDN
Available on jsdelivr (below), unpkg, and other CDN services that auto-publish npm packages.
import mergician from 'https://cdn.jsdelivr.net/npm/mergician@1/dist/mergician.min.mjs';
<script src="https://cdn.jsdelivr.net/npm/mergician@1/dist/mergician.min.js">
Usage & Options
See the documentation site for details and demos.
Contact & Support
License
This project is licensed under the MIT license.
Copyright (c) John Hildenbiddle (@jhildenbiddle)