Skip to content

Commit

Permalink
fix(@uform/utils): fix setIn with number key can not auto create array
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jul 4, 2019
1 parent a930f78 commit 48aa6d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/utils/src/accessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ function _setIn(obj, path, value) {

for (let i = 0; i < pathArr.length; i++) {
const p = pathArr[i]

const next = pathArr[i + 1]
if (!isObj(obj[p])) {
if (obj[p] === undefined && value === undefined) return
obj[p] = {}
obj[p] = /^\d+$/.test(next) ? [] : {}
}

if (i === pathArr.length - 1) {
Expand Down

0 comments on commit 48aa6d5

Please sign in to comment.