@newdash/newdash
Version:
javascript/typescript utility library
24 lines (23 loc) • 582 B
TypeScript
/**
* The opposite of `property`s method creates a function that returns
* the value at a given path of `object`.
*
* @since 5.0.0
* @category Util
* @param object The object to query.
* @returns Returns the new accessor function.
* @example
*
* ```js
* const array = [0, 1, 2]
* const object = { 'a': array, 'b': array, 'c': array }
*
* map(['a[2]', 'c[0]'], propertyOf(object))
* // => [2, 0]
*
* map([['a', '2'], ['c', '0']], propertyOf(object))
* // => [2, 0]
* ```
*/
declare function propertyOf(object: any): (path: any) => any;
export default propertyOf;