Given a string as dot notation, how would I create an object from that string (checking for already existing properties): eg
var obj = {}; stringToObj(\'a.b\
You can take advantage of references:
function stringToObj(path,value,obj) { var parts = path.split("."), part; while(part = parts.shift()) { if( typeof obj[part] != "object") obj[part] = {}; obj = obj[part]; // update "pointer" } obj["_x"] = value; }