UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

14 lines (10 loc) 471 B
'use strict'; var _rollupPluginBabelHelpers = require('./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(_rollupPluginBabelHelpers._toConsumableArray(a), _rollupPluginBabelHelpers._toConsumableArray(b.filter(x => a.findIndex(y => comp(x, y)) === -1))))); }; module.exports = unionWith;