From 844f6a3c8d4402aac5760e84e7ce842b55de7987 Mon Sep 17 00:00:00 2001 From: djalmajr Date: Sun, 20 Aug 2023 19:42:29 -0300 Subject: [PATCH] fix: set --- src/set.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/set.ts b/src/set.ts index 51612bf..7866720 100644 --- a/src/set.ts +++ b/src/set.ts @@ -20,7 +20,7 @@ export const set = curry((path: any, value: any, source: any) => { // prettier-ignore val = val[path[i]] = i === path.length - 1 ? typeof value === 'function' ? value(val[path[i]]) : value - : val[path[i]] ? copy(val[path[i]]) : +path[i+1] && [] || {}; + : val[path[i]] ? copy(val[path[i]]) : Number.isNaN(+path[i+1]) && [] || {}; } return src; }) as SetFn;