Checks if a parent identifier nests a child identifier.
Returns true if child's path is equal to or extends parent's path at a segment boundary,
meaning parent is a path prefix of child when compared segment by segment.
Both identifiers must be absolute hierarchical (scheme + root-relative path); returns false for
opaque, internal, or relative references. Query strings and fragments are ignored — only the path
component is compared.
A parent always nests itself (nests(x, x) is true).
Segment-boundary matching prevents false positives (e.g., /a/b does not nest /a/bc).
Parameters
parent: string
The potential parent identifier
child: string
The potential child identifier
Returns boolean
true if parent nests child; false otherwise
Throws
RangeError If either argument is not a valid identifier
Checks if a parent identifier nests a child identifier.
Returns
trueifchild's path is equal to or extendsparent's path at a segment boundary, meaningparentis a path prefix ofchildwhen compared segment by segment.Both identifiers must be absolute hierarchical (scheme + root-relative path); returns
falsefor opaque, internal, or relative references. Query strings and fragments are ignored — only the path component is compared.A parent always nests itself (
nests(x, x)istrue). Segment-boundary matching prevents false positives (e.g.,/a/bdoes not nest/a/bc).