I would like to achieve something like this:
let database = {
foo: {
bar: {}
}
}
deepValue(database, "foo/bar/hello") = "world"
console.log(database)
// database: {
// foo: {
// bar: {
// hello: "world"
// }
// }
// }
So deepValue returns the place in an object with the given path, so I can write to it. Is there something maybe in ES6, ES7 that could help me with this issue? Or is there a good way to generate the object path from a string?
Answered:
Ack, got closed before I could post. Here: jsfiddle.net/6bb1Lq6k – Jamiec