shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
mergeDeep
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object
Deep merge one object with another and return the merged object result. This merging implementation support:
- Merging object with getters/setters
- n numbers of objects as arguments
- Choose beetween cloning first (default) the object or keeping the first passed object as result Note that by default the resulting object is a clone and do not have the same reference that the first passed object.
Params
- objects*-any[]
Pass all the objects you want to merge
- settings{}TMergeDeepSettings
Some settings to configure your merging process
Return
- -Object
The merged object result
Example
import { mergeDeep } from '@blackbyte/sugar/object';
mergeDeep([{a: {b: {c: 'c', d: 'd'}}}, {a: {b: {e: 'e', f: 'f'}}}]);
// => { a: { b: { c: 'c', d: 'd', e: 'e', f: 'f' } } }Settings
- arrayfalseBoolean
Merge or not arrays
- clonetrueBoolean
Specify if you want the result object to be a clone or the same first passed object
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space