UNPKG

bbo

Version:

bbo is a utility library of zero dependencies for javascript.

11 lines (9 loc) 268 B
/** * Returns a list of elements that exist in both arrays, * after applying the provided function to each array element of both. */ function intersectBy(a, b, fn) { var s = new Set(b.map(fn)); return a.filter(x => s.has(fn(x))); } export default intersectBy;