path.matchesGlob(path, pattern)
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.】