typedash
Version:
modern, type-safe collection of utility functions
24 lines (22 loc) • 672 B
JavaScript
const require_isArray = require('./isArray-CK0opY_i.cjs');
const require_hasKey = require('./hasKey-Bt_UpAcG.cjs');
//#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 (require_isArray.isArray(path) ? path : path.split(".")).reduce((value, key) => {
if (require_hasKey.hasKey(value, key)) return value[key];
}, object);
}
//#endregion
Object.defineProperty(exports, 'get', {
enumerable: true,
get: function () {
return get;
}
});
//# sourceMappingURL=get-DviPilha.cjs.map