UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

17 lines 666 B
/** * Gets the value at `path` of `object` * @param object the target object * @param path the path of the property to get * @signature * P.path(object, path) * @signature * P.path(path)(object) * @example * P.path({x: { y: 1 }}, ['x', 'y']) // 1 * P.path({x: { y: 1 }}, ['y']) // undefined * P.pipe({x: { y: { z: { a: [0] }} }}, P.path("x.y.z.a.0".split('.'))) // 0 * @category Object, Pipe */ export declare function path(object: Record<string, unknown>, path: readonly string[]): unknown; export declare function path(path: readonly (string | number)[]): (object: Record<string, unknown>) => unknown; //# sourceMappingURL=path.d.ts.map