//#region src/array/array-unique.d.ts /** * Returns a new array with duplicate elements removed. The strategy used for * the equality check depends on the optional second argument: * * - When omitted, items are compared using `SameValueZero` (the same semantics * as `Set.prototype.has`). * - When a binary function `(a, b) => boolean` is passed, it is used as a * custom comparator (delegates to `uniqWith`). * - When a unary function `(value) => key` is passed, items are mapped through * it and the resulting keys are compared (delegates to `uniqBy`). * @param array - The array to deduplicate. Not mutated. * @returns A new array containing only the first occurrence of each unique element. * @example * // Basic equality (SameValueZero) * arrayUnique([1, 2, 1, 3, 2]); * // [1, 2, 3] * @example * // With a mapper — deduplicate by a derived key * arrayUnique([{id: 1, v: 'a'}, {id: 2, v: 'b'}, {id: 1, v: 'c'}], (item) => item.id); * // [{id: 1, v: 'a'}, {id: 2, v: 'b'}] * @example * // With a custom comparator * arrayUnique([{id: 1}, {id: 2}, {id: 1}], (a, b) => a.id === b.id); * // [{id: 1}, {id: 2}] */ declare function arrayUnique(array: readonly T[]): T[]; declare function arrayUnique(array: readonly T[], areItemsEqual: (a: T, b: T) => boolean): T[]; declare function arrayUnique(array: readonly T[], mapper: (value: T) => unknown): T[]; //#endregion export { arrayUnique };