-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Hi, there
Since our team recently upgraded set-value from v3 to v4, we found there's a severe problem dealing with numeric path.
before v4 paths are treated as properties, so it worked as expected like the following example
but since array index supported in v4, path contains numbers that causes target object's value transformed into an array anyway, and all its properties are gone.
the root cause might be on
Lines 148 to 150 in c574eb8
if (typeof next === 'number' && !Array.isArray(obj[key])) { | |
obj = obj[key] = []; | |
continue; |
but the quandary is, how to determine a numeric path is tending to set value to an array index or an object property?
I made a codesandbox to reproduce this issue, versions switch is available on the left panel, please let me know if any further information is needed
Metadata
Metadata
Assignees
Labels
No labels