js-util

Home > rc-js-util > arrayRemoveOne

arrayRemoveOne() function

Removes either 0 or one item from items, even if itemToRemove appears more than once.

Signature:

export declare function arrayRemoveOne<TItem>(items: TItem[], itemToRemove: TItem): boolean;

Parameters

Parameter Type Description
items TItem[]  
itemToRemove TItem  

Returns:

boolean

true if an item was removed.

Remarks

The lowest indexed item will be removed where there is more than one match.

See arrayRemoveOne().