@terminus/ngx-tools
Version:
[![CircleCI][circle-badge]][circle-link] [![codecov][codecov-badge]][codecov-project] [![semantic-release][semantic-release-badge]][semantic-release] [![MIT License][license-image]][license-url] <br> [![NPM version][npm-version-image]][npm-url] [![Github
15 lines (14 loc) • 583 B
TypeScript
/**
* Helper function to get an object with deep keys
*
* @param object - The object to query.
* @param path - The string path of the property to get.
* @param defaultValue - (optional) - The value returned for undefined resolved values.
* @returns The updated object
*
* @example
* const myObj = {foo: {bar: 'baz', bing: 'bang'}};
* objectDeepGet(myObj, 'foo.bar') // Returns: 'baz'
* objectDeepGet(myObj, 'does.not.exist', 'hi') // Returns: 'hi'
*/
export declare function objectDeepGet(object: Record<string, any>, path: string, defaultValue?: any): any;