@web3r/flowerkit
Version:
Tree-shakable JavaScript and TypeScript utility library for frontend/browser apps: DOM, events, arrays, objects, strings, date, JSON, and network helpers (ESM/CJS, SSR-friendly).
18 lines (17 loc) • 646 B
text/typescript
export type TGetUnionArgs = Parameters<typeof getUnion>;
export type TGetUnionReturn = ReturnType<typeof getUnion>;
/**
* Gets union Array of two given Arrays
* @template T
* @param {Array<T>} arr1 first source Array
* @param {Array<T>} arr2 sound source Array
* @returns {Array<T>}
* @throws {TypeError} getUnion: arr1 and arr2 must be arrays
* @example
* // How to merge two arrays in JavaScript and deduplicate items?
* const arr1 = [ 1, 2, 3 ];
* const arr2 = [ 2, 3, 4, 5 ];
* const union = getUnion(arr1, arr2);
* console.log(union); // => [ 1, 2, 3, 4, 5 ];
*/
export declare const getUnion: <T>(arr1: T[], arr2: T[]) => T[];