mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-25 22:53:09 +01:00
21 lines
505 B
JavaScript
21 lines
505 B
JavaScript
import initMatrix from '../../../client/initMatrix';
|
|
|
|
function AtoZ(aId, bId) {
|
|
let aName = initMatrix.matrixClient.getRoom(aId).name;
|
|
let bName = initMatrix.matrixClient.getRoom(bId).name;
|
|
|
|
// remove "#" from the room name
|
|
// To ignore it in sorting
|
|
aName = aName.replaceAll('#', '');
|
|
bName = bName.replaceAll('#', '');
|
|
|
|
if (aName.toLowerCase() < bName.toLowerCase()) {
|
|
return -1;
|
|
}
|
|
if (aName.toLowerCase() > bName.toLowerCase()) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
export { AtoZ };
|