let obj ={}
obj.myFIeld.insertedFIeld.deepField.additional.value = "qwe"
obj.myFIeld.insertedFIeld.deepField.additional.value = "qwe"
Object.prototype.fancyMethodName = function(path, value) {
let currentPath = this;
const propNamesArray = path.split('.');
const lastPropIndex = propNamesArray.length - 1;
propNamesArray.forEach((propName, idx) => {
if (idx >= lastPropIndex) {
currentPath[propName] = value;
return;
};
if (!currentPath.hasOwnProperty(propName)) {
currentPath[propName] = {};
};
currentPath = currentPath[propName];
});
};
let obj = {};
obj.fancyMethodName('a.b.c.d.e.f', 'some value' );
console.log(obj.a.b.c.d.e.f);