source: node_modules/es-toolkit/dist/array/intersection.d.ts

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

Added visualizations

  • Property mode set to 100644
File size: 849 bytes
Line 
1/**
2 * Returns the intersection of two arrays.
3 *
4 * This function takes two arrays and returns a new array containing the elements that are
5 * present in both arrays. It effectively filters out any elements from the first array that
6 * are not found in the second array.
7 *
8 * @template T - The type of elements in the array.
9 * @param {T[]} firstArr - The first array to compare.
10 * @param {T[]} secondArr - The second array to compare.
11 * @returns {T[]} A new array containing the elements that are present in both arrays.
12 *
13 * @example
14 * const array1 = [1, 2, 3, 4, 5];
15 * const array2 = [3, 4, 5, 6, 7];
16 * const result = intersection(array1, array2);
17 * // result will be [3, 4, 5] since these elements are in both arrays.
18 */
19declare function intersection<T>(firstArr: readonly T[], secondArr: readonly T[]): T[];
20
21export { intersection };
Note: See TracBrowser for help on using the repository browser.