(array: T[], item: T)
| 24 | * Immutably removes an item from an array. |
| 25 | */ |
| 26 | export 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 | } |
no outgoing calls
no test coverage detected