Skip to content

matches

matches(path, pattern, opts?): boolean

Does a concrete segmented path match a segment-pattern? The degenerate case of intersects: a concrete path is a literal SegmentPattern, so it intersects pattern exactly when it matches it.

ParameterTypeDescription
pathSegmentPatternThe concrete path, already split into segments.
patternSegmentPatternThe segment-pattern to test against.
opts?OptionsMatching semantics (Options); defaults apply when omitted.

boolean

true when path falls within pattern, else false.

matches(["src", "api", "user.ts"], ["src", "**", "*.ts"]); // true
matches(["README.md"], ["src", "**"]); // false