本文整理汇总了TypeScript中array-uniq.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: arrayUniq
await Promise.all(this.src().map(async (source: Source): Promise<void> => {
const options = {
...this.options,
...source.options
};
const sizes = arrayUniq(source.sizes.filter(/./.test, /^\d{2,4}x\d{2,4}$/i));
const keywords = arrayDiffer(source.sizes, sizes);
this.urls.push(source.url);
if (sizes.length === 0 && keywords.includes('w3counter')) {
return this.resolution(source.url, options);
}
if (keywords.length > 0) {
return this.viewport({url: source.url, sizes, keywords}, options);
}
for (const size of sizes) {
this.sizes.push(size);
// TODO: Make this concurrent
this.items.push(await this.create(source.url, size, options));
}
return undefined;
}));
开发者ID:sindresorhus,项目名称:pageres,代码行数:27,代码来源:index.ts
示例2: viewport
private async viewport(viewport: Viewport, options: Options): Promise<void> {
for (const item of await viewportListMem(viewport.keywords) as {size: string}[]) {
this.sizes.push(item.size);
viewport.sizes.push(item.size);
}
for (const size of arrayUniq(viewport.sizes)) {
this.items.push(await this.create(viewport.url, size, options));
}
}
开发者ID:sindresorhus,项目名称:pageres,代码行数:10,代码来源:index.ts
示例3: uniq
const getNpmPaths = function () {
if (process.env.NODE_PATH) {
return process.env.NODE_PATH.split(path.delimiter);
}
require('fix-path')();
// Get the npm path from the user env variables.
const paths = process.env.PATH.split(path.delimiter).map(item => path.join(item, '..', 'lib', 'node_modules'));
// Default paths for each system
if (win32) {
paths.push(path.join(process.env.APPDATA, 'npm', 'node_modules'));
} else {
paths.push('/usr/lib/node_modules');
}
try {
// Somehow `npm get prefix` does not return the correct value
const userconfig = childProcess.execSync('npm get userconfig', {encoding: 'utf8'}).toString().trim();
const content = fs.readFileSync(userconfig).toString('utf8');
const match = content.match(new RegExp(`prefix=(.*?)${EOL}`));
if (match) {
if (win32) {
paths.push(path.join(match[1], 'node_modules'));
} else {
paths.push(path.join(match[1], 'lib', 'node_modules'));
}
}
} catch (err) {
}
return uniq(paths.reverse());
};
开发者ID:Bolisov,项目名称:vscode-yo,代码行数:36,代码来源:environment.ts
注:本文中的array-uniq.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论