mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Cleanup hasPath modules.
This commit is contained in:
@@ -30,13 +30,12 @@ const hasOwnProperty = Object.prototype.hasOwnProperty
|
|||||||
function hasPath(object, path) {
|
function hasPath(object, path) {
|
||||||
path = castPath(path, object)
|
path = castPath(path, object)
|
||||||
|
|
||||||
let key
|
|
||||||
let index = -1
|
let index = -1
|
||||||
let length = path.length
|
let length = path.length
|
||||||
let result = false
|
let result = false
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
key = toKey(path[index])
|
const key = toKey(path[index])
|
||||||
if (!(result = object != null && hasOwnProperty.call(object, key))) {
|
if (!(result = object != null && hasOwnProperty.call(object, key))) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,12 @@ import toKey from './.internal/toKey.js'
|
|||||||
function hasPathIn(object, path) {
|
function hasPathIn(object, path) {
|
||||||
path = castPath(path, object)
|
path = castPath(path, object)
|
||||||
|
|
||||||
let key
|
|
||||||
let index = -1
|
let index = -1
|
||||||
let length = path.length
|
let length = path.length
|
||||||
let result = false
|
let result = false
|
||||||
|
|
||||||
while (++index < length) {
|
while (++index < length) {
|
||||||
key = toKey(path[index])
|
const key = toKey(path[index])
|
||||||
if (!(result = object != null && key in Object(object))) {
|
if (!(result = object != null && key in Object(object))) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -47,4 +46,4 @@ function hasPathIn(object, path) {
|
|||||||
(Array.isArray(object) || isArguments(object))
|
(Array.isArray(object) || isArguments(object))
|
||||||
}
|
}
|
||||||
|
|
||||||
export default hasPath
|
export default hasPathIn
|
||||||
|
|||||||
Reference in New Issue
Block a user