@oazmi/kitchensink - v0.9.13
    Preparing search index...

    Function bindDotPathTo

    • generate a dot-path getter and setter for a specific object given by bind_to.

      Parameters

      • bind_to: object

      Returns [
          get: <DP extends string>(dpath: DP) => DotPathValue<object, DP>,
          set: <DP extends string>(
              dpath: DP,
              value: DotPathValue<object, DP>,
          ) => object,
      ]

      import { assertEquals } from "jsr:@std/assert"

      const
      data = { kill: { your: { self: [0, 1, { 0: 0, 1: { noice: "YAHAHA", 0: "you found me!" } }] } } },
      [getData, setData] = bindDotPathTo(data)

      assertEquals(getData("kill.your.self.2.1"), {0: "you found me!", noice: "YAHAHA"})

      setData("kill.your.self.2.1.noice", ["arr", "ree", "eek"])

      assertEquals(getData("kill.your.self.2.1"), {0: "you found me!", noice: ["arr", "ree", "eek"]})