Not an answer to the question to get obj reference but it might be related. This is to set an object reference according to the dot notation
//# utilizing recursion, tree walk
const setDotNotationObject = (
levels: string[],
value,
targetObject,
) => {
const current = levels.shift();
if (levels.length > 0) {
const nested = (targetObject[current] = {});
setDotNotationObject(levels, value, nested);
return;
}
targetObject[current] = value;
};
//# usage
const targetObject = {};
setDotNotationObject(
"a.b.c",
'theValueToBeSet',
targetObject,
);