The target object
The path identifying the location of the final key value
The value to set
let theValue = { };
setValueByKey(theValue, "Hello.Darkness.my", "old");
// Resulting Object: { Hello: { Darkness: { my: "old" } } }
setValueByKey(theValue, "friend", "I've");
// Resulting Object: { Hello: { Darkness: { my: "old" } }, friend: "I've" }
setValueByKey(theValue, "come.to.see", "you");
// Resulting Object: { Hello: { Darkness: { my: "old" } }, friend: "I've", come: { to : { see: "you" } } }
Set the named value on the target object where the path may be presented by a string which contains "." characters to separate the nested objects of the heirarchy / path to the value.