I don't know how those functions should work, but this:
_.merge(['asd', 'asd', 1], ['asd', 'asd', 2])
don't return ['asd', 'asd', 1, 2] but ["asd", "asd", 2]. And:
_.difference(['asd', 'asd', 1], ['asd', 'asd', 2])
return [1] instead of [1,2].
Is that how those function should work? I'm using version 2.2.1
Difference is correct per documentation
_.difference(array, [values])
Creates an array excluding all values of the provided arrays using strict equality for comparisons, i.e. ===._.difference([1, 2, 3, 4, 5], [5, 2, 10]); // → [1, 3, 4]
_.merge is an object function thus we can expect it to merge by keys
As for the difference, this is the best I can think of
_.chain(array1.concat(array2, ...))
.countBy()
.pick(function(v) {return v === 1})
.keys()
.value()
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Difference is correct per documentation
_.merge is an object function thus we can expect it to merge by keys