merge
Merge two items
Available since v1.3.0.
description
Deeply merges two items (primitives, or object-like values). For primitives, merge
will return the right-hand side (the last argument you pass to the function). For collections (Array, Set, Map, Object
), merge will recursively merge each value as follows:
arrays & sets: values will be deduped
objects & maps: values associated to the same key will be merged recursively using
merge
Equality between two values is checked using equals
.
examples
merging two primitives
When the last argument is a primitive, it will always be the returned value.
merging two collections
When they are merged, collections are deduped by value for Arrays & Sets, and by key for Objects & Maps.
merging nested collections
Collections are merged recursively using merge.
Last updated