poteat / hkt-toolbelt

✨Functional and composable type utilities

Home Page:http://hkt.code.lol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `Object` methods for handling nested objects

MajorLift opened this issue · comments

The Object module currently lacks the following methods for accessing and updating nested properties.

  • Object.AtPathN
    • Get the nested values in object O at the paths and keys specified in P.
    • (P: (PropertyKey | PropertyKey[])[], O: Record) --> ?
  • Object.Update
    • Update a nested value in object O at path P.
    • (P: PropertyKey[], V: ?, O: Record) --> Record
  • Object.UpdateN
    • Update multiple nested values in object O at paths and keys specified in P, using values specified in V.
    • (P: (PropertyKey | PropertyKey[])[], V: ?[], O: Record) --> Record

The implementation should include unit tests and JSDoc comments that adhere to the guidelines established in the style-guide/ directory.

Closed by #82