/utils/merge
An XYZ utility module to merge complex objects [including function parameters] deeply.
The utility is required to compose nested workspace object properties [eg locales, layer] from templates.
- Source
Methods
(inner) arrayMerge()
Method checks whether the provided source and target objects have array properties with the same key.
The source array will be spread into the target array only if it contains items which are not included in the target array.
- Source
(inner) isObject()
Method checks whether the item param is an Object but not an Array.
- Source
(inner) mergeDeep()
Method receives a target object and sources arguments spread into an array.
The target will be returned if the sources array argument has no length.
A source will be shited from the sources array argument and processed against the target object.
Each source object property will be iterated if both the target and source are object instances.
The method will iterate over itself until the object arguments are merged into the target.
- Source
(inner) objectMerge()
The method will create an empty object if the target object does not have a key property.
The mergeDeep method will be called recursive to merge the source key object into the target key object property.
- Source