UNPKG

es-next-tools

Version:

A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.

14 lines (13 loc) 512 B
/** * Returns an array of elements that are present in both input arrays. * @param {T[]} array1 - The first array. * @param {T[]} array2 - The second array. * @returns {T[]} An array containing elements present in both input arrays. * @template T * @deprecated - Use Set.intersection() instead. * @example * const arr1 = [1, 2, 3, 4, 5]; * const arr2 = [3, 4, 5, 6, 7]; * const result = intersection(arr1, arr2); // [3, 4, 5] */ export declare function intersection<T>(array1: T[], array2: T[]): T[];