Skip to content

Commit 7c92111

Browse files
committed
Fixin scope range for var declarations in hasPath and hasPathIn.
1 parent 96ebd44 commit 7c92111

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

hasPath.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ function hasPath(object, path) {
3131
path = castPath(path, object)
3232

3333
let index = -1
34-
let length = path.length
34+
let { length } = path
3535
let result = false
36+
let key
3637

3738
while (++index < length) {
38-
const key = toKey(path[index])
39+
key = toKey(path[index])
3940
if (!(result = object != null && hasOwnProperty.call(object, key))) {
4041
break
4142
}

hasPathIn.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ function hasPathIn(object, path) {
2828
path = castPath(path, object)
2929

3030
let index = -1
31-
let length = path.length
31+
let { length } = path
3232
let result = false
33+
let key
3334

3435
while (++index < length) {
35-
const key = toKey(path[index])
36+
key = toKey(path[index])
3637
if (!(result = object != null && key in Object(object))) {
3738
break
3839
}

0 commit comments

Comments
 (0)