From 46ffbc1d9086d4f2bd1d049624b2e3a1fcbcb0cd Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 Feb 2017 23:01:51 -0800 Subject: [PATCH] Cleanup `hasPath` modules. --- hasPath.js | 3 +-- hasPathIn.js | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/hasPath.js b/hasPath.js index 08c6ac893..36277a877 100644 --- a/hasPath.js +++ b/hasPath.js @@ -30,13 +30,12 @@ const hasOwnProperty = Object.prototype.hasOwnProperty function hasPath(object, path) { path = castPath(path, object) - let key let index = -1 let length = path.length let result = false while (++index < length) { - key = toKey(path[index]) + const key = toKey(path[index]) if (!(result = object != null && hasOwnProperty.call(object, key))) { break } diff --git a/hasPathIn.js b/hasPathIn.js index aef7e026e..f4c30a222 100644 --- a/hasPathIn.js +++ b/hasPathIn.js @@ -27,13 +27,12 @@ import toKey from './.internal/toKey.js' function hasPathIn(object, path) { path = castPath(path, object) - let key let index = -1 let length = path.length let result = false while (++index < length) { - key = toKey(path[index]) + const key = toKey(path[index]) if (!(result = object != null && key in Object(object))) { break } @@ -47,4 +46,4 @@ function hasPathIn(object, path) { (Array.isArray(object) || isArguments(object)) } -export default hasPath +export default hasPathIn