本文整理汇总了TypeScript中glob.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: while
fs.readFile('src/compiler/diagnosticInformationMap.generated.ts', 'utf-8', (err, data) => {
let errorRegexp = /\s(\w+): \{ code/g;
let errorNames: string[] = [];
let errMatch: string[];
while (errMatch = errorRegexp.exec(data)) {
errorNames.push(errMatch[1]);
}
let allSrc: string = '';
glob('./src/**/*.ts', {}, (err, files) => {
console.log('Reading ' + files.length + ' source files');
for (let file of files) {
if (file.indexOf('diagnosticInformationMap.generated.ts') > 0) {
continue;
}
let src = fs.readFileSync(file, 'utf-8');
allSrc = allSrc + src;
}
console.log('Consumed ' + allSrc.length + ' characters of source');
let count = 0;
console.log('== List of errors not used in source ==');
for (let errName of errorNames) {
if (allSrc.indexOf(errName) < 0) {
console.log(errName);
count++;
}
}
console.log(count + ' of ' + errorNames.length + ' errors are not used in source');
});
});
示例2: build
export function build(srcDir: string, options = {}) {
//const _dtsCreator = require('typed-css-modules');
let dtsCreator = new DtsCreator({
srcDir
});
return glob(srcDir + globSuffix, {}, (error: any, files: string[]) => files.forEach(writeFile(dtsCreator)));
}
示例3: glob
return new Promise<string[]>((resolve, reject) => {
glob(pattern, { ignore }, (error, matches) => {
if (error) {
reject(error)
} else {
resolve(matches)
}
})
})
示例4: glob
return new Promise<string[]>((resolve, reject) => {
glob(globPattern, (err, files: string[]) => {
if (err) {
reject(err);
}
resolve(files);
});
})
示例5: Promise
return new Promise((resolve, reject) => {
glob(pattern, { root: dir, nocase: true }, (error, files) => {
if (error || (required && (!files || !files.length))) {
reject(error || `Could not find files matching ${glob} in ${dir}.`);
} else {
resolve(files);
}
});
});
示例6: Promise
return new Promise((resolve, reject) => {
glob(pattern, options || {}, (err, matches) => {
if (err) {
reject(err);
} else {
resolve(matches);
}
});
});
示例7:
return new Promise<string[]>((c, e) => {
glob(task.pattern, task.opts, (err, files: string[]) => {
if (err) {
e(err);
} else {
c(files);
}
});
});
示例8: glob
return new Promise<string[]>((resolve, reject) => {
glob(
pattern,
globOptions,
(error, files) => {
if (error) { reject(error) }
else { resolve(files) }
}
)
})
示例9: glob
return new Promise<string[]>((resolve, reject) => {
glob(globFileName, (err, files) => {
/* istanbul ignore if */
if (err) {
reject(err);
return;
}
resolve(files);
});
});
示例10: Promise
return new Promise((resolve, reject) => {
glob(
globPattern,
{ cwd: process.cwd(), ignore: ['**/node_modules/**'] },
(error: any, files: string[]) => {
if (error) {
return reject(error);
}
resolve(files);
}
);
});