本文整理匯總了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);
}
);
});