4.17.11
3.10.1
2.4.2
1.3.1

_.has(object, path)

Checks if path is a direct property of object.

Since

0.1.0

Arguments

argument
object
path
type
Object
(Array|string)
description
The object to query.
The path to check.

Returns

(array)

Example

var object = { a: { b: 2 } };
var other = _.create({
  a: _.create({ b: 2 }),
});

_.has(object, "a");
// => true

_.has(object, "a.b");
// => true

_.has(object, ["a", "b"]);
// => true

_.has(other, "a");
// => false
var object = { a: { b: 2 } };
var other = _.create({ a: _.create({ b: 2 }) });

_.has(object, "a");
// => true

_.has(object, "a.b");
// => true

_.has(object, ["a", "b"]);
// => true

_.has(other, "a");
// => false