From 5445349fd0bdbc4c48030736e4ceb26013f3a112 Mon Sep 17 00:00:00 2001 From: djalmajr Date: Sun, 20 Aug 2023 19:48:11 -0300 Subject: [PATCH] fix: set again --- src/set.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/set.ts b/src/set.ts index 7866720..9e0fd7d 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]]) : Number.isNaN(+path[i+1]) && [] || {}; + : val[path[i]] ? copy(val[path[i]]) : path[i+1]*0 === 0 && [] || {}; } return src; }) as SetFn;