moderndash
moderndash copied to clipboard
Feature request - `mergeWith`
Hello
I would like to know, if you planning to create a mergeWith
function allowing to customize the merge function. The perfect use exemple is to merge nested array :
mergeWith(
{ a: [1, 2] },
{ a: [3, 4] },
(a, b) => Array.isArray(a) && Array.isArray(b) => [...a, ...b] : undefined
)
// => { a: [1, 2, 3, 4] }
lodash doc: https://lodash.com/docs/4.17.15#mergeWith
Hi, surely a good addition!
We could add this to the merge
function, similar to difference
where you can append a compare function as the last parameter.
But I don't know when I will find the time to do this. A PR would be appreciated!
Hi, any updates?
I tried for a short while to extend the merge
Function, but didn't found a good enough solution that would be fully typesafe. A MR is appreciated, in the next few months I will have the time to look at it again.