Checks if path is a direct or inherited property of object.
path
object
The object to query.
The path to check.
Returns true if path exists, else false.
true
false
var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });_.hasIn(object, 'a');// => true_.hasIn(object, 'a.b.c');// => true_.hasIn(object, ['a', 'b', 'c']);// => true_.hasIn(object, 'b');// => false Copy
var object = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });_.hasIn(object, 'a');// => true_.hasIn(object, 'a.b.c');// => true_.hasIn(object, ['a', 'b', 'c']);// => true_.hasIn(object, 'b');// => false
Checks if
path
is a direct or inherited property ofobject
.