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


TypeScript IdleValue.getValue方法代碼示例

本文整理匯總了TypeScript中vs/base/common/async.IdleValue.getValue方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IdleValue.getValue方法的具體用法?TypeScript IdleValue.getValue怎麽用?TypeScript IdleValue.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/base/common/async.IdleValue的用法示例。


在下文中一共展示了IdleValue.getValue方法的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.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。