Skip to content

Commit

Permalink
Fixin scope range for var declarations in hasPath and hasPathIn.
Browse files Browse the repository at this point in the history
  • Loading branch information
falsyvalues committed Apr 4, 2017
1 parent 96ebd44 commit 7c92111
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions hasPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 3 additions & 2 deletions hasPathIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

2 comments on commit 7c92111

@jdalton
Copy link
Member

@jdalton jdalton commented on 7c92111 Apr 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on the ECMAScript module (esm) module loader so these basic mistakes will be caught sooner.

@falsyvalues
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I'm working on eslint settings to catch more of these 😄

Please sign in to comment.