當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript array-uniq.default函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。