@ctrl/golang-template
Version:
Basic golang template parsing in js
17 lines • 509 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.get = void 0;
/**
* Gets the value at `path` of `object`.
* @param object
* @param path
* @returns value if exists else undefined
*/
function get(object, path) {
if (typeof path === 'string') {
path = path.split('.').filter((key) => key.length);
}
return path.reduce((dive, key) => dive === null || dive === void 0 ? void 0 : dive[key], object);
}
exports.get = get;
//# sourceMappingURL=util.js.map