本文整理匯總了TypeScript中vs/base/common/strings.compareIgnoreCase函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript compareIgnoreCase函數的具體用法?TypeScript compareIgnoreCase怎麽用?TypeScript compareIgnoreCase使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了compareIgnoreCase函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: defaultComparator
function defaultComparator(a: ISuggestionItem, b: ISuggestionItem): number {
let ret = 0;
// check with 'sortText'
if (typeof a.suggestion.sortText === 'string' && typeof b.suggestion.sortText === 'string') {
ret = compareIgnoreCase(a.suggestion.sortText, b.suggestion.sortText);
}
// check with 'label'
if (ret === 0) {
ret = compareIgnoreCase(a.suggestion.label, b.suggestion.label);
}
// check with 'type' and lower snippets
if (ret === 0 && a.suggestion.type !== b.suggestion.type) {
if (a.suggestion.type === 'snippet') {
ret = 1;
} else if (b.suggestion.type === 'snippet') {
ret = -1;
}
}
return ret;
}
示例2: areSameExtensions
export function areSameExtensions(a: IExtensionIdentifier, b: IExtensionIdentifier): boolean {
if (a.uuid && b.uuid) {
return a.uuid === b.uuid;
}
if (a.id === b.id) {
return true;
}
return compareIgnoreCase(a.id, b.id) === 0;
}