deepie-merge
v1.3.0
Published
Yay, another deep merge
Downloads
1,483
Readme
deepie-merge
Yay, another deep merge
Usage
npm i deepie-merge
import {deepMerge} from "deepie-merge";
deepMerge({a: [1]}, {a: [2]});
// => {a: [2]}
deepMerge({a: [1]}, {a: [2]}, {arrayExtend: true});
// => {a: [1, 2]}
deepMerge({a: [1], b: [1]}, {a: [2], b: [2]}, {arrayExtend: ["a"]});
// => {a: [1, 2], b: [2]}
API
deepMerge(dst, src, options)
dst
any: Destination valuesrc
any: Source valueoptions
object:arrayExtend
boolean or string[]: Whether to extend arrays instead of replacing them. When passed a string array, it will only extend the object keys provided in that array.maxRecursions
number: Amount of nesting levels to recurse into. Default:10
© silverwind, distributed under BSD licence