Skip to content

Commit

Permalink
fix: prevent array creation w/ float-type keys
Browse files Browse the repository at this point in the history
- Closes #11
  • Loading branch information
lukeed committed Sep 8, 2018
1 parent 0cbf2c6 commit 2b9ec49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ export default function (obj, keys, val) {
var i=0, l=keys.length, t=obj, x;
for (; i < l; ++i) {
x = t[keys[i]];
t = t[keys[i]] = (i === l - 1 ? val : (x == null ? (+keys[i + 1] > -1 ? [] : {}) : x));
t = t[keys[i]] = (i === l - 1 ? val : (x != null ? x : (!!~keys[i+1].indexOf('.') || !(+keys[i+1] > -1)) ? {} : []));
}
}

0 comments on commit 2b9ec49

Please sign in to comment.