UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

22 lines 703 B
//#region src/array/union.d.ts /** * `union(target, source)` * * Returns a new array containing all unique elements from both `target` and `source`. Elements from `source` that are not already in `target` are added to the result. * * ```ts * union([1, 2, 3], [3, 4, 5]); // [1, 2, 3, 4, 5] * ``` * * ```ts * pipe([1, 2, 3], union([3, 4, 5])); // [1, 2, 3, 4, 5] * ``` */ declare const union: { <T>(source: Iterable<NoInfer<T>>): (target: T[]) => T[]; <T>(source: Iterable<NoInfer<T>>): (target: readonly T[]) => readonly T[]; <T>(target: T[], source: Iterable<NoInfer<T>>): T[]; <T>(target: readonly T[], source: Iterable<NoInfer<T>>): readonly T[]; }; //#endregion export { union };