UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines 687 B
//#region src/set/intersection.d.ts /** * `intersection(target, source)` * * Returns a new set containing only the values that exist in both the `target` set and the `source` set. * * ```ts * intersection(new Set([1, 2, 3]), new Set([2, 3, 4])); // Set([2, 3]) * intersection(new Set([1, 2]), new Set([3, 4])); // Set([]) * ``` * * ```ts * pipe(new Set([1, 2, 3]), intersection(new Set([2, 3, 4]))); // Set([2, 3]) * pipe(new Set([1, 2]), intersection(new Set([3, 4]))); // Set([]) * ``` */ declare const intersection: { <T, U>(source: Set<U>): (target: Set<T>) => Set<T | U>; <T, U>(target: Set<T>, source: Set<U>): Set<T | U>; }; //#endregion export { intersection };