akheron / optics-ts

Type-safe, ergonomic, polymorphic optics for TypeScript
MIT License
773 stars 9 forks source link

Support JSON-Pointer RFC #241

Closed thadk closed 1 year ago

thadk commented 2 years ago

Maybe I'm misunderstanding as I'm still learning the library with Jotai, but it seems like it might be possible to use the JSON Pointer RFC standard to focus the optics on a path, in addition to the existing optics-ts syntax. What do you think?

I find JSON-Pointer useful with same-type-recursive-referential tree-like data structures which I haven't figured out how to deeply use in optics-ts yet.

Here are a few reference implementations:

thadk commented 1 year ago

I read the JSON Pointer spec more closely and besides delimiter handling, actually the RFC doesn't add much over what is already in Optics-TS so I'm going to close this but I'll put my implementation here in this issue if I do end up writing a converter function from JSON Pointer strings.