本文整理汇总了TypeScript中minimatch.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
return files.filter(f => {
if (f == null) return false
if (ignoreHidden && /^\./.test(f)) return false
for (let p of ignorePatterns) {
if (minimatch(f, p, { dot: true })) return false
}
return true
})
示例2: score1
function score1(selector: DocumentSelector[0], candidateUri: string, candidateLanguage: string): number {
if (typeof selector === 'string') {
// Shorthand notation: "mylang" -> {language: "mylang"}, "*" -> {language: "*""}.
if (selector === '*') {
return 5
} else if (selector === candidateLanguage) {
return 10
} else {
return 0
}
}
const { language, scheme, pattern } = selector
let ret = 0
if (scheme) {
if (candidateUri.startsWith(scheme + ':')) {
ret = 10
} else if (scheme === '*') {
ret = 5
} else {
return 0
}
}
if (language) {
if (language === candidateLanguage) {
ret = 10
} else if (language === '*') {
ret = Math.max(ret, 5)
} else {
return 0
}
}
if (pattern) {
if (pattern === candidateUri || candidateUri.endsWith(pattern) || minimatch(candidateUri, pattern)) {
ret = 10
} else if (minimatch(candidateUri, '**/' + pattern)) {
ret = 5
} else {
return 0
}
}
return ret
}
示例3: multiGlobMatches
export function multiGlobMatches(patterns: string[], path: string): boolean {
let matched = false;
for (const p of patterns) {
const isExclude = p[0] === '!';
if (matched !== isExclude) {
break;
}
matched = minimatch(path, p);
}
return matched;
}
示例4: isExcluded
protected static isExcluded(file: string, excludes: string[]) {
if (excludes.length === 0) {
return false;
}
for (const exclude of excludes) {
if (minimatch(file, exclude)) {
return true;
}
}
return false;
}
示例5: isIncluded
protected static isIncluded(file: string, includes: string[]) {
if (includes.length === 0) {
return true;
}
for (const include of includes) {
if (minimatch(file, include)) {
return true;
}
}
return false;
}
示例6: function
parsers.forEach((parser) => {
if (minimatch(path, parser.glob)) {
fs.readFile(path, { encoding: 'utf-8' }, function(err, source) {
if (err)
return cache.error({
message: err.message,
stack: err.stack && err.stack.toString(),
link: null
})
var artifact = parser.parse(source)
cache.saveAST(project, path, artifact)
})
}
});
示例7: minimatch
var fileMatches = files.some((filePath) => minimatch(changedFilePath, filePath));
示例8: minimatch
&& configData.revisedFiles.some(revisedFile => minimatch(filePath, revisedFile))) {
示例9: minimatch
return gitIgnore.some(line => minimatch(p, line));