reactotron-redux
Version:
A Reactotron plugin for Redux.
21 lines (20 loc) • 530 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = pathObject;
function pathObject(path, obj) {
if (!path) return obj;
const splitPaths = path.split(".");
let pathedObj = obj;
for (let i = 0; i < splitPaths.length; i++) {
const curPath = splitPaths[i];
pathedObj = pathedObj[curPath];
if (i < splitPaths.length - 1 && typeof pathedObj !== "object") {
pathedObj = undefined;
break;
}
}
return pathedObj;
}
//# sourceMappingURL=pathObject.js.map