Expand description
The single path grammar used by every traversal operation.
A dot separates segments. \. embeds a dot in a key, \\ embeds a
backslash, and \* embeds a star. Every other escape is rejected so a path
is reversible.
A bare * segment is reserved: it means “each child here” to the commands
that accept a pattern, and parse_path refuses it rather than reading it
as a key. * is a legal key in JSON, so join_path escapes it — a
document carrying one is still addressable, as \*.
A segment may be empty, because "" is a legal key in JSON and YAML — npm
writes one into every package-lock.json as the root package. Rejecting it
did not make it unreachable, only unspeakable: join_path still rendered
["packages", ""] as packages., so paths emitted addresses that value
and set then refused, and the reversibility this grammar exists to
guarantee did not hold.
The one sequence with no spelling is [""] on its own: it renders as the
empty string, which names no path at all. A "" key at the document root is
therefore unaddressable, and that is the only hole left.
Enums§
- Pattern
Segment - One segment of a path that may address many nodes.
Functions§
- join_
path - parse_
path - parse_
path_ pattern - Parse a path in which a bare
*segment means “each child here”.