UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

13 lines (10 loc) 433 B
import { b as _toConsumableArray } from './internal/_rollupPluginBabelHelpers.js'; /** * Returns every element that exists in any of the two arrays once, * after applying the provided function to each array element of both. */ var unionBy = (a, b, fn) => { var s = new Set(a.map(fn)); return Array.from(new Set([].concat(_toConsumableArray(a), _toConsumableArray(b.filter(x => !s.has(fn(x))))))); }; export default unionBy;