MCPcopy Create free account
hub / github.com/kobaltedev/kobalte / removeItemFromArray

Function removeItemFromArray

packages/utils/src/array.ts:26–35  ·  view source on GitHub ↗
(array: T[], item: T)

Source from the content-addressed store, hash-verified

24 * Immutably removes an item from an array.
25 */
26export function removeItemFromArray<T>(array: T[], item: T) {
27 const updatedArray = [...array];
28 const index = updatedArray.indexOf(item);
29
30 if (index !== -1) {
31 updatedArray.splice(index, 1);
32 }
33
34 return updatedArray;
35}

Callers 3

registerNestedMenuFunction · 0.90
addFunction · 0.90
removeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected