Custom Merge
Create a custom merge function
npm install custom-merge
Usage
var createMerge = extend = defaults = defaultOptions = awesome:true hidden:false // { a:5, b:2, c:{ d:[1,2,3,4] } } // { awesome:true, hidden:true }
Options
inPlace
Boolean
When true
(default), merges changes into the first argument. When false
, merges changes into a clone of the first argument.
deep
Boolean
When true
(default) merges additional levels. When false
, only merges the top level.
array
String
'replace'
(default): When two arrays are to be merged, replace one with the other'concat'
: When two arrays are to be merged, concatenate the arrays'merge'
: When two arrays are to be merged, merge their corresponding indexes
priority
String
'right'
(default): When replacing values, use the rightmost value'left'
:When replacing values, use the leftmost value