A non pure lodash way to do this but using the array.concat function you are able to do this pretty simply along uniq()
:
var objUnion = function(array1, array2, matcher) {
var concated = array1.concat(array2)
return _.uniq(concated, false, matcher);
}
An alternative approach would be to use flatten() and uniq():
var union = _.uniq(_.flatten([array1, array2]), matcherFn);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…