UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

29 lines (28 loc) 778 B
import { purry } from './purry'; import { _reduceLazy } from './_reduceLazy'; export function difference() { return purry(_difference, arguments, difference.lazy); } function _difference(array, other) { var lazy = difference.lazy(other); return _reduceLazy(array, lazy); } (function (difference) { function lazy(other) { var set = new Set(other); return function (value) { if (!set.has(value)) { return { done: false, hasNext: true, next: value, }; } return { done: false, hasNext: false, }; }; } difference.lazy = lazy; })(difference || (difference = {}));