4.17.11
3.10.1
2.4.2
1.3.1

_.hasIn(object, path)

Checks if path is a direct or inherited property of object.

Since

4.0.0

Arguments

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

Returns

(array)

Example

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

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

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

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

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

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

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

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

_.hasIn(object, "b");
// => false