File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ export class SortUtil {
1010 }
1111
1212 customSort ( a : string , b : string ) : number {
13+ const sortOrderReverse = this . settings . sortOrderReverse
1314 const sortOrder = this . settings . getCustomSortKeywords ( this . custom )
1415 const indexA = sortOrder . indexOf ( a )
1516 const indexB = sortOrder . indexOf ( b )
1617
1718 if ( indexA > - 1 && indexB > - 1 ) {
18- return SortUtil . compare ( indexA , indexB )
19+ return SortUtil . compare ( sortOrderReverse , indexA , indexB )
1920 }
2021 if ( indexA !== - 1 && indexB === - 1 ) {
2122 return - 1
@@ -26,13 +27,15 @@ export class SortUtil {
2627 return this . localeSort ( a , b )
2728 }
2829
29- static compare ( a : number , b : number ) {
30+ static compare ( reverse : boolean , a : number , b : number ) {
3031 if ( a > b ) {
31- return 1
32+ return reverse ? - 1 : + 1
3233 }
34+
3335 if ( a < b ) {
34- return - 1
36+ return reverse ? + 1 : - 1
3537 }
38+
3639 return 0
3740 }
3841
You can’t perform that action at this time.
0 commit comments