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 }