From fa0f75c5b6281f3eb03060c9341e84cc439a7a01 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Wed, 27 Oct 2021 06:22:38 +0530 Subject: [PATCH] chore: use `while` loop (#29) --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f5628ec..75a01fb 100644 --- a/src/index.js +++ b/src/index.js @@ -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('.')) ? {} : [];