Just curious how this would be accomplished in Javascript? Lets say I have an object such as
var obj = {
'foo.bar.baz': 'valueA',
'foo.bar.qux': 'valueB'
};
How can I iteratively turn these into a nested object such as
console.log(obj.foo.bar.baz); // valueA
console.log(obj.foo.bar.qux); // valueB
It would be something like this I think?
var ret=[];
for (var key in obj)
{
var parts = key.split('.');
for (var i in parts)
{
if (parts.hasOwnProperty(i))
{
// do something?
}
}
ret.push(something);
}