remeda
Version:
A utility library for JavaScript and Typescript.
48 lines • 1.66 kB
text/typescript
//#region src/differenceWith.d.ts
type IsEquals<TFirst, TSecond> = (a: TFirst, b: TSecond) => boolean;
/**
* Excludes the values from `other` array.
* Elements are compared by custom comparator isEquals.
*
* @param array - The source array.
* @param other - The values to exclude.
* @param isEquals - The comparator.
* @signature
* R.differenceWith(array, other, isEquals)
* @example
* R.differenceWith(
* [{a: 1}, {a: 2}, {a: 3}, {a: 4}],
* [{a: 2}, {a: 5}, {a: 3}],
* R.equals,
* ) // => [{a: 1}, {a: 4}]
* @dataFirst
* @lazy
* @category Array
*/
declare function differenceWith<TFirst, TSecond>(array: ReadonlyArray<TFirst>, other: ReadonlyArray<TSecond>, isEquals: IsEquals<TFirst, TSecond>): Array<TFirst>;
/**
* Excludes the values from `other` array.
* Elements are compared by custom comparator isEquals.
*
* @param other - The values to exclude.
* @param isEquals - The comparator.
* @signature
* R.differenceWith(other, isEquals)(array)
* @example
* R.differenceWith(
* [{a: 2}, {a: 5}, {a: 3}],
* R.equals,
* )([{a: 1}, {a: 2}, {a: 3}, {a: 4}]) // => [{a: 1}, {a: 4}]
* R.pipe(
* [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}, {a: 6}], // only 4 iterations
* R.differenceWith([{a: 2}, {a: 3}], R.equals),
* R.take(2),
* ) // => [{a: 1}, {a: 4}]
* @dataLast
* @lazy
* @category Array
*/
declare function differenceWith<TFirst, TSecond>(other: ReadonlyArray<TSecond>, isEquals: IsEquals<TFirst, TSecond>): (array: ReadonlyArray<TFirst>) => Array<TFirst>;
//#endregion
export { differenceWith };
//# sourceMappingURL=differenceWith-Bcc7ppfz.d.cts.map