diff --git a/src/array/replaceOrAppend.ts b/src/array/replaceOrAppend.ts index b5584f18..e0c0a598 100644 --- a/src/array/replaceOrAppend.ts +++ b/src/array/replaceOrAppend.ts @@ -28,7 +28,7 @@ export function replaceOrAppend( const out = array.slice() for (let index = 0; index < array.length; index++) { if (match(array[index], index)) { - out.splice(index, 1, newItem) + out[index] = newItem; return out } }