UNPKG

@snap/camera-kit

Version:
16 lines 592 B
export function unionBy(iteratee, ...arrays) { const throwIterateeError = () => { throw new Error("Iteratee must be a function or a valid property key of the item"); }; const seen = new Map(); for (const item of arrays.flat()) { const key = typeof iteratee === "function" ? iteratee(item) : typeof item === "object" && item !== null && iteratee in item ? item[iteratee] : throwIterateeError(); seen.set(key, item); } return Array.from(seen.values()); } //# sourceMappingURL=unionBy.js.map