From 7c921110678be128255c6317e4ea729f538fc0cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipi=C5=84ski?= Date: Tue, 4 Apr 2017 20:37:52 +0200 Subject: [PATCH] Fixin scope range for var declarations in `hasPath` and `hasPathIn`. --- hasPath.js | 5 +++-- hasPathIn.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hasPath.js b/hasPath.js index 36277a8772..2a3a7fb6fc 100644 --- a/hasPath.js +++ b/hasPath.js @@ -31,11 +31,12 @@ function hasPath(object, path) { path = castPath(path, object) let index = -1 - let length = path.length + let { length } = path let result = false + let key while (++index < length) { - const key = toKey(path[index]) + key = toKey(path[index]) if (!(result = object != null && hasOwnProperty.call(object, key))) { break } diff --git a/hasPathIn.js b/hasPathIn.js index f4c30a222a..5b9b5a2666 100644 --- a/hasPathIn.js +++ b/hasPathIn.js @@ -28,11 +28,12 @@ function hasPathIn(object, path) { path = castPath(path, object) let index = -1 - let length = path.length + let { length } = path let result = false + let key while (++index < length) { - const key = toKey(path[index]) + key = toKey(path[index]) if (!(result = object != null && key in Object(object))) { break }