当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript async.IdleValue类代码示例

本文整理汇总了TypeScript中vs/base/common/async.IdleValue的典型用法代码示例。如果您正苦于以下问题:TypeScript IdleValue类的具体用法?TypeScript IdleValue怎么用?TypeScript IdleValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IdleValue类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: compareFileExtensions

export function compareFileExtensions(one: string | null, other: string | null): number {
	if (intlFileNameCollator) {
		const [oneName, oneExtension] = extractNameAndExtension(one);
		const [otherName, otherExtension] = extractNameAndExtension(other);

		let result = intlFileNameCollator.getValue().collator.compare(oneExtension, otherExtension);

		if (result === 0) {
			// Using the numeric option in the collator will
			// make compare(`foo1`, `foo01`) === 0. We must disambiguate.
			if (intlFileNameCollator.getValue().collatorIsNumeric && oneExtension !== otherExtension) {
				return oneExtension < otherExtension ? -1 : 1;
			}

			// Extensions are equal, compare filenames
			result = intlFileNameCollator.getValue().collator.compare(oneName, otherName);

			if (intlFileNameCollator.getValue().collatorIsNumeric && result === 0 && oneName !== otherName) {
				return oneName < otherName ? -1 : 1;
			}
		}

		return result;
	}

	return noIntlCompareFileExtensions(one, other);
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:27,代码来源:comparers.ts

示例2: compareFileNames

export function compareFileNames(one: string | null, other: string | null, caseSensitive = false): number {
	if (intlFileNameCollator) {
		const a = one || '';
		const b = other || '';
		const result = intlFileNameCollator.getValue().collator.compare(a, b);

		// Using the numeric option in the collator will
		// make compare(`foo1`, `foo01`) === 0. We must disambiguate.
		if (intlFileNameCollator.getValue().collatorIsNumeric && result === 0 && a !== b) {
			return a < b ? -1 : 1;
		}

		return result;
	}

	return noIntlCompareFileNames(one, other, caseSensitive);
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:17,代码来源:comparers.ts


注:本文中的vs/base/common/async.IdleValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。