rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
86 lines (40 loc) • 988 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [arrayReplaceOne](./rc-js-util.arrayreplaceone.md)
## arrayReplaceOne() function
Replaces the first match of itemToRemove with replaceWith.
**Signature:**
```typescript
export declare function arrayReplaceOne<TItem>(items: TItem[], itemToRemove: TItem, replaceWith: TItem): boolean;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
items
</td><td>
TItem\[\]
</td><td>
</td></tr>
<tr><td>
itemToRemove
</td><td>
TItem
</td><td>
</td></tr>
<tr><td>
replaceWith
</td><td>
TItem
</td><td>
</td></tr>
</tbody></table>
**Returns:**
boolean
true if an element was replaced.
## Remarks
See [arrayReplaceOne()](./rc-js-util.arrayreplaceone.md)<!-- -->.