2020-09-10 18:04:03 +00:00
|
|
|
import { ProviderRepresentation } from "./clients/models/server-info";
|
2020-08-31 18:26:25 +00:00
|
|
|
|
2020-09-01 14:51:59 +00:00
|
|
|
export const sortProvider = (
|
|
|
|
a: [string, ProviderRepresentation],
|
|
|
|
b: [string, ProviderRepresentation]
|
|
|
|
) => {
|
2020-08-31 18:26:25 +00:00
|
|
|
let s1, s2;
|
|
|
|
if (a[1].order != b[1].order) {
|
|
|
|
s1 = b[1].order;
|
|
|
|
s2 = a[1].order;
|
2020-09-01 14:51:59 +00:00
|
|
|
} else {
|
2020-08-31 18:26:25 +00:00
|
|
|
s1 = a[0];
|
|
|
|
s2 = b[0];
|
2020-09-01 14:51:59 +00:00
|
|
|
}
|
2020-08-31 18:26:25 +00:00
|
|
|
if (s1 < s2) {
|
|
|
|
return -1;
|
|
|
|
} else if (s1 > s2) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|