generate a dot-path getter and setter for a specific object given by bind_to
dot-path
bind_to
const data = { kill: { your: { self: [0, 1, { 0: 0, 1: { noice: "YAHAHA", 0: "you found me!" } }] } } }const [getData, setData] = bindDotPathTo(data)console.log(getData("kill.your.self.2.1")) // {0: "you found me!", noice: "YAHAHA"}setData("kill.your.self.2.1.noice", ["arr", "ree", "eek"])console.log(getData("kill.your.self.2.1")) // {0: "you found me!", noice: ["arr", "ree", "eek"]} Copy
const data = { kill: { your: { self: [0, 1, { 0: 0, 1: { noice: "YAHAHA", 0: "you found me!" } }] } } }const [getData, setData] = bindDotPathTo(data)console.log(getData("kill.your.self.2.1")) // {0: "you found me!", noice: "YAHAHA"}setData("kill.your.self.2.1.noice", ["arr", "ree", "eek"])console.log(getData("kill.your.self.2.1")) // {0: "you found me!", noice: ["arr", "ree", "eek"]}
generate a
dot-path
getter and setter for a specific object given bybind_to
Example