path.matchesGlob(path, pattern)
-
path<string> 用于 glob 匹配的路径。¥
path<string> The path to glob-match against. -
pattern<string> 用于检查路径的 glob。¥
pattern<string> The glob to check the path against. -
返回:<boolean>
path是否与pattern匹配。¥Returns: <boolean> Whether or not the
pathmatched thepattern.
path.matchesGlob() 方法确定 path 是否与 pattern 匹配。
¥The path.matchesGlob() method determines if path matches the pattern.
例如:
¥For example:
path.matchesGlob('/foo/bar', '/foo/*'); // true
path.matchesGlob('/foo/bar*', 'foo/bird'); // false 如果 path 或 pattern 不是字符串,则抛出 TypeError。
¥A TypeError is thrown if path or pattern are not strings.