UNPKG

@newdash/newdash

Version:

javascript/typescript utility library

30 lines (29 loc) 824 B
/** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @since 5.3.0 * @category Object * @param object The object to query. * @param path The path of the property to get. * @param defaultValue The value returned for `undefined` resolved values. * @returns Returns the resolved value. * @see has, hasIn, set, unset * @example * * ```js * const object = { 'a': [{ 'b': { 'c': 3 } }] } * * get(object, 'a[0].b.c') * // => 3 * * get(object, ['a', '0', 'b', 'c']) * // => 3 * * get(object, 'a.b.c', 'default') * // => 'default' * ``` */ export declare function get(object: any, path: Array<string>, defaultValue?: any): any; export declare function get(object: any, path: string, defaultValue?: any): any; export default get;