@monstermann/fn
Version:
A utility library for TypeScript.
22 lines • 650 B
TypeScript
//#region src/set/union.d.ts
/**
* `union(target, source)`
*
* Returns a new set containing all unique values from both the `target` set and the `source` set.
*
* ```ts
* union(new Set([1, 2]), new Set([2, 3, 4])); // Set([1, 2, 3, 4])
* union(new Set([1, 2]), new Set([3, 4])); // Set([1, 2, 3, 4])
* ```
*
* ```ts
* pipe(new Set([1, 2]), union(new Set([2, 3, 4]))); // Set([1, 2, 3, 4])
* pipe(new Set([1, 2]), union(new Set([3, 4]))); // Set([1, 2, 3, 4])
* ```
*/
declare const union: {
<T, U>(source: Set<U>): (target: Set<T>) => Set<T | U>;
<T, U>(target: Set<T>, source: Set<U>): Set<T | U>;
};
//#endregion
export { union };