本文整理汇总了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;
}));
示例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));
}
}
示例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());
};