@unction/mergedeepleft
v10.15.0
Published
Takes a left and right collection and recuresively combines them prefering right: merge for Object and concat for Array
Downloads
22
Readme
@unction/mergeDeepLeft
Array | Set | Record<string | number | symbol, B> | Map<B, A> | string => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string
Recursively merges two enumerables. Merges objects with merge
and arrays with concat. Prefers left. THAT IS ALL.
const left = {
alpha: "1"
}
const right = {
beta: "2"
}
mergeDeepLeft(left)(right)
{
alpha: "1",
beta: "2"
}
const left = {
alpha: {
alpha1: "1"
}
}
const right = {
beta: {
beta1: "1"
}
}
mergeDeepLeft(left)(right)
{
alpha: {
alpha1: "1"
},
beta: {
beta1: "1"
}
}
const left = {
alpha: [
"1"
]
}
const right = {
alpha: [
"1"
]
}
mergeDeepLeft(left)(right)
{
alpha: [
"1",
"1"
]
}