mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Cleanup hasPath modules.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user