remeda
Version:
A utility library for JavaScript and Typescript.
37 lines • 1.33 kB
text/typescript
//#region src/intersection.d.ts
/**
* Returns a list of elements that exist in both array. The output maintains the
* same order as the input. The inputs are treated as multi-sets/bags (multiple
* copies of items are treated as unique items).
*
* @param data - The input items.
* @param other - The items to compare against.
* @signature
* R.intersection(data, other)
* @example
* R.intersection([1, 2, 3], [2, 3, 5]); // => [2, 3]
* R.intersection([1, 1, 2, 2], [1]); // => [1]
* @dataFirst
* @lazy
* @category Array
*/
declare function intersection<T, S>(data: ReadonlyArray<T>, other: ReadonlyArray<S>): Array<S & T>;
/**
* Returns a list of elements that exist in both array. The output maintains the
* same order as the input. The inputs are treated as multi-sets/bags (multiple
* copies of items are treated as unique items).
*
* @param other - The items to compare against.
* @signature
* R.intersection(other)(data)
* @example
* R.pipe([1, 2, 3], R.intersection([2, 3, 5])); // => [2, 3]
* R.pipe([1, 1, 2, 2], R.intersection([1])); // => [1]
* @dataFirst
* @lazy
* @category Array
*/
declare function intersection<S>(other: ReadonlyArray<S>): <T>(data: ReadonlyArray<T>) => Array<S & T>;
//#endregion
export { intersection };
//# sourceMappingURL=intersection-BDbWc__y.d.cts.map