js-util

Home > rc-js-util > arrayReplaceOne

arrayReplaceOne() function

Replaces the first match of itemToRemove with replaceWith.

Signature:

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

Parameters

Parameter Type Description
items TItem[]  
itemToRemove TItem  
replaceWith TItem  

Returns:

boolean

true if an element was replaced.

Remarks

See arrayReplaceOne().