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
var object = { 'a': { 'b': { 'c': 3 } } };var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });_.has(object, 'a');// => true_.has(object, 'a.b.c');// => true_.has(object, ['a', 'b', 'c']);// => true_.has(other, 'a');// => false Copy
var object = { 'a': { 'b': { 'c': 3 } } };var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });_.has(object, 'a');// => true_.has(object, 'a.b.c');// => true_.has(object, ['a', 'b', 'c']);// => true_.has(other, 'a');// => false
Checks if
path
is a direct property ofobject
.