@unction/mergewithkey
v9.13.0
Published
Takes a function that determines how to merge two conflicting values in a merge and gives you a the conflicting key
Downloads
161
Readme
@unction/mergeWithKey
MapperFunctionType<L, MapperFunctionType<R, MapperFunctionType<K, V>>> => KeyedEnumerableType<R, K> => KeyedEnumerableType<L, K> => ListType | Record<string | number | symbol, V> | Map<K, V> | string
Merges two keyed enumerables and uses a function to handle conflicts. The function is given the left value, the right value, and the key.
const left = {
beta: "1"
}
const right = {
beta: "2"
}
mergeWithKey((left) => (right) => (key) => key+leftValue+rightValue)(left)(right)
Which returns:
{
beta: "beta12"
}