caseinsesitive compare

This commit is contained in:
_Bastler
2021-10-06 16:31:00 +02:00
parent 3a29e2db87
commit 4ddb51ba55
7 changed files with 29 additions and 9 deletions
+4 -1
View File
@@ -35,7 +35,10 @@ export class QuotasComponent implements OnInit {
});
}
compare(a: number | string | String, b: number | string | String, isAsc: boolean) {
compare(a: number | string , b: number | string , isAsc: boolean) {
if (typeof a === 'string' && typeof b === 'string') {
return a.localeCompare(b,undefined, { sensitivity: 'accent' } ) * (isAsc ? 1 : -1);
}
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
}