Helper module for parsing and stringifying SuperJSON dot-notated and escaped path strings
(e.g., "user.created_at", "items.0.name", "a\.1.b", "a\\\.1.b").
Summary
Functions
Parses a SuperJSON path string into a list of keys and Access.at/1 index structs.
Stringifies a list of keys and integers into a SuperJSON path string. Dots and backslashes in keys are escaped.
Functions
Parses a SuperJSON path string into a list of keys and Access.at/1 index structs.
Examples
iex> SuperJSON.Path.parse("a.b.c")
["a", "b", "c"]
iex> SuperJSON.Path.parse("items.0")
["items", Access.at(0)]
iex> SuperJSON.Path.parse("a\\.1.b")
["a.1", "b"]
Stringifies a list of keys and integers into a SuperJSON path string. Dots and backslashes in keys are escaped.
Examples
iex> SuperJSON.Path.stringify(["a", 0, "b"])
"a.0.b"
iex> SuperJSON.Path.stringify(["a.1", "b"])
"a\\.1.b"