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

View File

@ -124,7 +124,10 @@ export class AliasesComponent 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);
}
}

View File

@ -126,7 +126,10 @@ export class DomainsComponent 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);
}
}

View File

@ -37,7 +37,10 @@ export class PermissionsComponent 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);
}
}

View File

@ -70,11 +70,13 @@ export class ProfileFieldsComponent 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);
}
openEdit(profileField) {
const resetProfileField = JSON.parse(JSON.stringify(profileField));

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);
}

View File

@ -32,8 +32,11 @@ export class ServicesGridComponent 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);
}
}

View File

@ -34,7 +34,10 @@ export class ServicesTableComponent 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);
}
}