UNPKG

typedash

Version:

modern, type-safe collection of utility functions

19 lines (17 loc) 546 B
import { t as isArray } from "./isArray-DkX32HVI.js"; import { t as hasKey } from "./hasKey-CJQn8BcL.js"; //#region src/functions/get/get.ts /** * Implementation of all overloads. * @param object The object to query. * @param path The path of the property to get. * @returns The value at path of object. */ function get(object, path) { return (isArray(path) ? path : path.split(".")).reduce((value, key) => { if (hasKey(value, key)) return value[key]; }, object); } //#endregion export { get as t }; //# sourceMappingURL=get-CZehGTw1.js.map