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