本文整理汇总了TypeScript中globule.find函数的典型用法代码示例。如果您正苦于以下问题:TypeScript find函数的具体用法?TypeScript find怎么用?TypeScript find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: replacePureView
export const removePureView = (dir: string) => {
globule.find(path.join(dir, "**/*.sol")).forEach((filepath) => {
let source = fs.readFileSync(filepath, "utf-8");
source = replacePureView(source);
fs.writeFileSync(filepath, source);
});
};
开发者ID:iurimatias,项目名称:embark-framework,代码行数:7,代码来源:code.ts
示例2: findFiles
export function findFiles(pattern: any, includeDir: boolean, cwd?: string): string[] {
let patterns: string[] = [];
let baseDir = isNullOrWhitespace(cwd) ? process.cwd() : cwd;
tl.debug('Input pattern: ' + pattern + ' cwd: ' + baseDir);
if (typeof pattern === 'string') {
patterns = [pattern];
} else if (pattern instanceof Array) {
patterns = pattern;
}
let searchPattern = extractPattern(patterns, baseDir);
let globPattern: string[] = searchPattern.includePatterns;
searchPattern.excludePatterns.forEach(p => globPattern.push('!' + p));
tl.debug('Glob pattern: ' + JSON.stringify(globPattern));
let result = globule.find(globPattern);
tl.debug('Glob result length: ' + result.length);
if (!includeDir) {
return result.filter(isFile);
}
return result;
}
开发者ID:DarqueWarrior,项目名称:vsts-tasks,代码行数:26,代码来源:find-files-legacy.ts
示例3: defaults
collect: (conf) => {
// 未定義の時はDefault値
var config = defaults(conf, {
root: 'src',
include_ext: ['.ts', '.coffee'],
exclude_ext: ['.d.ts']
});
// プロジェクト内のソースを収集
var includes = config.include_ext.map((x) => { return config.root + '/**/*' + x; });
var excludes = config.exclude_ext.map((x) => { return '!' + config.root + '/**/*' + x; });
var files = globule.find(includes.concat(excludes));
// ファイルからタグ一覧を収集する
var tags = Enumerable.from(files)
.select((file) => {
var ret = grepSync(['-w', tag_name, file]);
if (!ret) {
return {};
}
var type_value = ret.split(tag_name)[1].trim();
var split = type_value.split('=');
var type = split[0];
var value = split[1];
// value内の文字列を取り出す
var matched = value.match(/[\"\'](.+)[\"\']/);
if (!matched) {
errLog("failed to value.match file:" + file);
return {};
}
var parsed_value = parseValues(matched[1], file);
return toTagObject(file, type, parsed_value);
})
.where((obj) => { return Object.keys(obj).length > 0; })
.toArray();
//console.log("-----------------------");
//console.log("tags:");
//console.log(tags);
//console.log("-----------------------");
return tags;
},
开发者ID:wordijp,项目名称:frontend-base-project,代码行数:46,代码来源:ambient-external-module.ts
示例4: RegExp
Object.keys(convertExt).forEach(from => {
const to = convertExt[(from as convertExtFrom)];
globule.find([`**/*.${from}`, `!**/_*.${from}`], {cwd: dir.src}).forEach(filename => {
files[filename.replace(new RegExp(`.${from}$`), `.${to}`)] = path.join(dir.src, filename);
});
});
开发者ID:bitst0rm-dev,项目名称:a-la-carte,代码行数:6,代码来源:webpack.config.ts
示例5:
import * as globule from 'globule';
let filepaths: string[];
filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });
filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });
let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });
let mappings = globule.mapping(['*.js']);
const len = mappings.length;
const src = mappings[0].src;
const dest = mappings[0].dest;
mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
mappings = globule.mapping(['*.js'], ['*.less']);
开发者ID:EmmaRamirez,项目名称:DefinitelyTyped,代码行数:27,代码来源:globule-tests.ts
注:本文中的globule.find函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论