Skip to content

Commit

Permalink
chore: use while loop (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit2sharma95 authored Oct 27, 2021
1 parent 6515792 commit fa0f75c
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
@@ -1,7 +1,7 @@
export function dset(obj, keys, val) {
keys.split && (keys=keys.split('.'));
var i=0, l=keys.length, t=obj, x, k;
for (; i < l;) {
while (i < l) {
k = keys[i++];
if (k === '__proto__' || k === 'constructor' || k === 'prototype') break;
t = t[k] = (i === l) ? val : (typeof(x=t[k])===typeof(keys)) ? x : (keys[i]*0 !== 0 || !!~(''+keys[i]).indexOf('.')) ? {} : [];
Expand Down

0 comments on commit fa0f75c

Please sign in to comment.