/** * Removes duplicate items from an array, optionally using a custom key extractor. * * Iterates through the input array and returns a new array containing only the first * occurrence of each unique item. If a predicate function is provided, its return value * is used as the unique key for comparison instead of the item itself. * * @template T The type of the items in the input array. * @param array - The array to deduplicate. * @param predicate - Optional. A function that returns the value to use for uniqueness checks. * @returns A new array containing only unique items. * * @example * ```ts * unique([1, 2, 2, 3]); // [1, 2, 3] * * unique( * [{ id: 1, name: 'A' }, { id: 1, name: 'B' }, { id: 2, name: 'C' }], * item => item.id * ); * // [{ id: 1, name: 'A' }, { id: 2, name: 'C' }] * ``` */ export declare function unique(array: T[], predicate?: (item: T) => unknown): T[]; //# sourceMappingURL=unique.d.ts.map