uniqueElementsArray
Function that given one or more array of object, returns a single array with unique elements by a specified property, an array of properties or none.
Types
UniqueElementsArrayProps
@templateT - The element type of the input arrays.
Parameters accepted by all overloads of uniqueElementsArray.
| Property | Type | Required | Description |
|---|---|---|---|
property | keyof T \| (keyof T)[] \| "none" | ✓ | The property key (or array of keys) used to determine uniqueness when T is an object. Pass "none" to compare elements by value (identity for primitives, referential equality for objects). |
args | (T[])[] | ✓ | One or more arrays whose elements are merged and deduplicated. Duplicates are determined by the property strategy. |
UniqueElementsArrayResult
@templateT - The element type.
Return value of uniqueElementsArray.
A new array containing only unique elements from all provided input arrays, preserving the order of first occurrence.
ts
export type UniqueElementsArrayResult<T> = T[];