@@ -1490,6 +1490,16 @@ namespace ts {
14901490 return a === b ;
14911491 }
14921492
1493+ /**
1494+ * Compare equality between two strings using an ordinal comparison.
1495+ *
1496+ * Case-insensitive comparisons compare both strings after applying `toUpperCase` to
1497+ * each string.
1498+ */
1499+ export function equateStrings ( a : string , b : string , ignoreCase : boolean ) {
1500+ return ignoreCase ? equateStringsCaseInsensitive ( a , b ) : equateStringsCaseSensitive ( a , b ) ;
1501+ }
1502+
14931503 export function equateStringsCaseInsensitive ( a : string , b : string ) {
14941504 return a === b
14951505 || a !== undefined
@@ -1501,16 +1511,6 @@ namespace ts {
15011511 return equateValues ( a , b ) ;
15021512 }
15031513
1504- /**
1505- * Compare equality between two strings using an ordinal comparison.
1506- *
1507- * Case-insensitive comparisons compare both strings after applying `toUpperCase` to
1508- * each string.
1509- */
1510- export function equateStrings ( a : string , b : string , ignoreCase : boolean ) {
1511- return ignoreCase ? equateStringsCaseInsensitive ( a , b ) : equateStringsCaseSensitive ( a , b ) ;
1512- }
1513-
15141514 export function getStringEqualityComparer ( ignoreCase : boolean ) {
15151515 return ignoreCase ? equateStringsCaseInsensitive : equateStringsCaseSensitive ;
15161516 }
@@ -1557,6 +1557,20 @@ namespace ts {
15571557 return ignoreCase ? compareStringsCaseInsensitive : compareStringsCaseSensitive ;
15581558 }
15591559
1560+ /**
1561+ * Compare two strings using the sort behavior of the UI locale.
1562+ *
1563+ * Ordering is not predictable between different host locales, but is best for displaying
1564+ * ordered data for UI presentation. Characters with multiple unicode representations may
1565+ * be considered equal.
1566+ *
1567+ * Case-insensitive comparisons compare strings that differ in only base characters or
1568+ * accents/diacritic marks as unequal.
1569+ */
1570+ export function compareStringsUI ( a : string , b : string , ignoreCase : boolean ) {
1571+ return ignoreCase ? compareStringsCaseInsensitiveUI ( a , b ) : compareStringsCaseSensitiveUI ( a , b ) ;
1572+ }
1573+
15601574 /**
15611575 * Creates a string comparer for use with string collation in the UI.
15621576 */
@@ -1660,24 +1674,17 @@ namespace ts {
16601674 return comparer ( a , b ) ;
16611675 }
16621676
1663- /**
1664- * Compare two strings using the sort behavior of the UI locale.
1665- *
1666- * Ordering is not predictable between different host locales, but is best for displaying
1667- * ordered data for UI presentation. Characters with multiple unicode representations may
1668- * be considered equal.
1669- *
1670- * Case-insensitive comparisons compare strings that differ in only base characters or
1671- * accents/diacritic marks as unequal.
1672- */
1673- export function compareStringsUI ( a : string , b : string , ignoreCase : boolean ) {
1674- return ignoreCase ? compareStringsCaseInsensitiveUI ( a , b ) : compareStringsCaseSensitiveUI ( a , b ) ;
1675- }
1676-
16771677 export function getStringComparerUI ( ignoreCase : boolean ) {
16781678 return ignoreCase ? compareStringsCaseInsensitiveUI : compareStringsCaseSensitiveUI ;
16791679 }
16801680
1681+ export function compareProperties < T > ( a : T , b : T , key : keyof T ) {
1682+ return a === b ? Comparison . EqualTo :
1683+ a === undefined ? Comparison . LessThan :
1684+ b === undefined ? Comparison . GreaterThan :
1685+ compareValues ( a [ key ] , b [ key ] ) ;
1686+ }
1687+
16811688 function getDiagnosticFileName ( diagnostic : Diagnostic ) : string {
16821689 return diagnostic . file ? diagnostic . file . fileName : undefined ;
16831690 }
0 commit comments