export type Comparator = (a: A, b: B) => boolean; export type DiffResult = { added: B[]; updated: B[]; removed: A[]; }; /** * Compute diff between two arrays. * @param previous * @param next * @param comparator */ export declare const diff: (previous: readonly A[], next: readonly B[], comparator: Comparator) => DiffResult; export declare const intersection: (a: A[], b: B[], comparator: Comparator) => A[]; /** * Returns a new array with only the first instance of each unique item * based on a specified property. * * @typeParam T - The type of items in the input array. * @param array - The array to filter for distinct items. * @param key - The property key to determine uniqueness for each item. * @returns A new array with only distinct items based on the specified property. */ export declare const distinctBy: (array: T[], selector: (item: T) => K) => T[]; /** * Remove elements from array. * @param array * @param test * @returns removed elements. */ export declare const removeBy: (array: T[], test: (element: T, index: number) => boolean) => T[]; /** * Splits an array based on a type guard predicate function. * Infers the output tuple types from the guard function. */ export declare const partition: (array: T[], guard: (item: T, index: number, array: T[]) => boolean) => [T[], T[]]; /** * Returns elements that exist in all provided arrays based on a selector function. * * @param arrays - Arrays to intersect. * @param selector - Function to extract the comparison value from each element. * @returns Array containing elements from the first array that exist in all other arrays. */ export declare const intersectBy: (arrays: T[][], selector: (item: T) => K) => T[]; //# sourceMappingURL=array.d.ts.map