Checks if path is a direct property of object.
path
object
The object to query.
The path to check.
Returns true if path exists, else false.
true
false
5.0.0
has, hasIn, hasPathIn
const object = { 'a': { 'b': 2 } }const other = create({ 'a': create({ 'b': 2 }) })hasPath(object, 'a.b')// => truehasPath(object, ['a', 'b'])// => true Copy
const object = { 'a': { 'b': 2 } }const other = create({ 'a': create({ 'b': 2 }) })hasPath(object, 'a.b')// => truehasPath(object, ['a', 'b'])// => true
Checks if
path
is a direct property ofobject
.