UNPKG

diginext-utils

Version:
18 lines 594 B
/** * Creates an array of values that are present in all given arrays. * Returns elements that exist in every array. * * @template T - The type of elements in the arrays * @param array1 - First array * @param array2 - Second array * @returns A new array containing only values present in both arrays * * @example * ```ts * intersection([1, 2, 3], [2, 3, 4]); // [2, 3] * intersection(['a', 'b'], ['b', 'c']); // ['b'] * intersection([1, 2], [3, 4]); // [] * ``` */ export declare function intersection<T>(array1: T[], array2: T[]): T[]; //# sourceMappingURL=intersection.d.ts.map