parse
parse(
pathLike,opts?):SegmentPattern
Split a path-like glob into segments on the separator. Each segment is a glob
token, verbatim — no classification. A trailing separator (which splits into
an empty final segment) is normalized off, so src/api/ == src/api.
Nothing else is collapsed or inferred.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pathLike | string | A path-like glob string, e.g. "src/api/**". |
opts? | { separator?: string; } | Parsing options. separator overrides the split character (default "/"). |
opts.separator? | string | - |
Returns
Section titled “Returns”The SegmentPattern — the segments in order, the segment core’s unit.
Remarks
Section titled “Remarks”No inference: a pattern with no wildcards is an exact-path match
(src/siteA/components matches only that path, not files beneath it); opt
into a subtree explicitly with a trailing **. Only a single trailing
separator is normalized off.
Example
Section titled “Example”parse("src/api/**"); // ["src", "api", "**"]parse("src/api/"); // ["src", "api"] — trailing separator normalized offparse("README.md"); // ["README.md"] — no wildcards → an exact-path match