source: node_modules/es-toolkit/dist/compat/array/intersection.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: 812 bytes
Line 
1/**
2 * Returns the intersection of multiple arrays.
3 *
4 * This function takes multiple arrays and returns a new array containing the elements that are
5 * present in all provided arrays. It effectively filters out any elements that are not found
6 * in every array.
7 *
8 * @template T - The type of elements in the arrays.
9 * @param {...(ArrayLike<T> | null | undefined)} arrays - The arrays to compare.
10 * @returns {T[]} A new array containing the elements that are present in all arrays.
11 *
12 * @example
13 * const array1 = [1, 2, 3, 4, 5];
14 * const array2 = [3, 4, 5, 6, 7];
15 * const result = intersection(array1, array2);
16 * // result will be [3, 4, 5] since these elements are in both arrays.
17 */
18declare function intersection<T>(...arrays: Array<ArrayLike<T> | null | undefined>): T[];
19
20export { intersection };
Note: See TracBrowser for help on using the repository browser.