Skip to content

whichMatch

whichMatch(path, patterns, opts?): string[]

Which patterns in the set match a concrete path, in the order given.

ParameterTypeDescription
pathstringThe concrete path to test.
patternsPatternsThe pattern-set to filter (Patterns).
opts?OptionsMatching semantics (Options); defaults apply when omitted.

string[]

The subset of patterns that match path, in input order.

whichMatch("src/api/user.ts", ["src/api/**", "src/**", "docs/**"]);
// → ["src/api/**", "src/**"] (docs/** does not match)