bbo
Version:
bbo is a utility library of zero dependencies for javascript.
12 lines (9 loc) • 401 B
JavaScript
import { b as _toConsumableArray } from './internal/_rollupPluginBabelHelpers.js';
/**
* Returns every element that exists in any of the two arrays once,
* using a provided comparator function.
*/
var unionWith = (a, b, comp) => {
return Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => a.findIndex(y => comp(x, y)) === -1)))));
};
export default unionWith;