source: node_modules/es-toolkit/dist/compat/array/unionWith.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[a762898]1/**
2 * This method is like `union` except that it accepts `comparator` which
3 * is invoked to compare elements of `arrays`. The comparator is invoked
4 * with two arguments: (arrVal, othVal).
5 *
6 * @template T
7 * @param {ArrayLike<T> | null | undefined} arrays - The arrays to inspect.
8 * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element.
9 * @returns {T[]} Returns the new array of combined values.
10 *
11 * @example
12 * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
13 * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
14 * unionWith(objects, others, isEqual);
15 * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
16 */
17declare function unionWith<T>(arrays: ArrayLike<T> | null | undefined, comparator?: (a: T, b: T) => boolean): T[];
18/**
19 * This method is like `union` except that it accepts `comparator` which
20 * is invoked to compare elements of `arrays`. The comparator is invoked
21 * with two arguments: (arrVal, othVal).
22 *
23 * @template T
24 * @param {ArrayLike<T> | null | undefined} arrays - The first array to inspect.
25 * @param {ArrayLike<T> | null | undefined} arrays2 - The second array to inspect.
26 * @param {(a: T, b: T) => boolean} [comparator] - The comparator invoked per element.
27 * @returns {T[]} Returns the new array of combined values.
28 *
29 * @example
30 * unionWith([1, 2], [2, 3], (a, b) => a === b);
31 * // => [1, 2, 3]
32 */
33declare function unionWith<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, comparator?: (a: T, b: T) => boolean): T[];
34/**
35 * This method is like `union` except that it accepts `comparator` which
36 * is invoked to compare elements of `arrays`. The comparator is invoked
37 * with two arguments: (arrVal, othVal).
38 *
39 * @template T
40 * @param {ArrayLike<T> | null | undefined} arrays - The first array to inspect.
41 * @param {ArrayLike<T> | null | undefined} arrays2 - The second array to inspect.
42 * @param {ArrayLike<T> | null | undefined} arrays3 - The third array to inspect.
43 * @param {...Array<(a: T, b: T) => boolean | ArrayLike<T> | null | undefined>} comparator - The comparator invoked per element.
44 * @returns {T[]} Returns the new array of combined values.
45 *
46 * @example
47 * unionWith([1], [2], [3], (a, b) => a === b);
48 * // => [1, 2, 3]
49 */
50declare function unionWith<T>(arrays: ArrayLike<T> | null | undefined, arrays2: ArrayLike<T> | null | undefined, arrays3: ArrayLike<T> | null | undefined, ...comparator: Array<((a: T, b: T) => boolean) | ArrayLike<T> | null | undefined>): T[];
51
52export { unionWith };
Note: See TracBrowser for help on using the repository browser.