Any value to query.
The query path.
Given a deep-search query path, returns an object property or array value of an object or array as an object
, or
undefined
if a value was not found or was not type-compatible.
const obj = { foo: { bar: [{ name: 'baz' }] } };
const value = getObject(obj, 'foo.bar[1]', { name: 'buzz' });
// type of value -> object; value -> { name: 'buzz' }
Any value to query.
The query path.
The default to return if the query result was not defined.
Given a deep-search query path, returns an object property or array value of an object or array as an
object
, orundefined
if a value was not found or was not type-compatible.