Skip to content

Function: matches()

Documentation / @wtf/platform-fs / glob / matches

function matches(pattern, path): boolean;

Defined in: packages/platform-fs/src/glob.ts:153

Whether path, of names between /, matches pattern, or any of patterns, as glob matches a path of a folder, and Node’s path.matchesGlob matches one: * any part of a name, ? one character, […] one of them, {a,b} each of a and b, and ** any folders; a name of a dot only by a part that starts with one, and none by **. A . of either is no name, and a pattern that ends in / matches a path that does alone. Of no file system: the path is the text it is.

matches('guides/**/*.md', 'guides/start/index.md') // true

Parameters

ParameterType
patternstring | readonly string[]
pathstring

Returns

boolean