Home > rc-js-util > arrayPushUnique
Like Array.push
but checks if the value is unique first.
Signature:
export declare function arrayPushUnique<TItem>(items: TItem[], itemToPush: TItem, getComparisonValue?: (item: TItem) => unknown): boolean;
Parameter | Type | Description |
---|---|---|
items | TItem[] | |
itemToPush | TItem | |
getComparisonValue | (item: TItem) => unknown | (Optional) |
Returns:
boolean
true if an element was pushed.
See arrayPushUnique().