From 0bfd3d25dc22c8ed1b931f3587cb3169cca138ab Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:53:08 -0400 Subject: [PATCH] Update src/array/replaceOrAppend.ts Co-authored-by: Vladimir Ivakin --- src/array/replaceOrAppend.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 } }