UNPKG

@augment-vir/common

Version:

A collection of augments, helpers types, functions, and classes for any JavaScript environment.

26 lines (25 loc) 583 B
/** * Finds all duplicates. * * @category Array * @category Package : @augment-vir/common * @example * * ```ts * import {extractDuplicates} from '@augment-vir/common'; * * const result = extractDuplicates([ * 'a', * 'b', * '', * 'a', * ]); * // result is `{duplicates: ['a'], uniques: ['b', '']}` * ``` * * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function extractDuplicates<T>(items: ReadonlyArray<T>, comparator?: (a: T, b: T) => boolean): { duplicates: T[]; uniques: T[]; };