@e-group/material-form
Version:
Custom react components for integrate redux-form.
20 lines (16 loc) • 579 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* To solve index path bug please read this for more detail.
* https://stackoverflow.com/questions/6393943/convert-javascript-string-in-dot-notation-into-an-object-reference
*/
const indexPath = (obj = {}, path = '') => {
var _path$match;
const matchArray = (_path$match = path.match(/[^\]\\[.]+/g)) !== null && _path$match !== void 0 ? _path$match : [];
return matchArray.reduce((o, i) => o[i], obj);
};
var _default = indexPath;
exports.default = _default;