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;