hasIn

Object
since 4.0.0

Arguments

  • Object The object to query.
  • Array|string The path to check.

Returns

boolean `true` if `path` exists, else `false`.

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

Example of Lodash _.hasIn

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