Deduplicate string compare utility (#9579)

This commit is contained in:
Michael Telatynski
2022-11-15 10:20:36 +00:00
committed by GitHub
parent 436146105e
commit e66027cd0c
9 changed files with 9 additions and 18 deletions

View File

@@ -16,10 +16,10 @@ limitations under the License.
import { groupBy, mapValues, maxBy, minBy, sumBy, takeRight } from "lodash";
import { MatrixClient, Room, RoomMember } from "matrix-js-sdk/src/matrix";
import { compare } from "matrix-js-sdk/src/utils";
import { Member } from "./direct-messages";
import DMRoomMap from "./DMRoomMap";
import { compare } from "./strings";
export const compareMembers = (
activityScores: Record<string, IActivityScore>,

View File

@@ -75,16 +75,6 @@ export function copyNode(ref: Element): boolean {
return document.execCommand('copy');
}
const collator = new Intl.Collator();
/**
* Performant language-sensitive string comparison
* @param a the first string to compare
* @param b the second string to compare
*/
export function compare(a: string, b: string): number {
return collator.compare(a, b);
}
/**
* Returns text which has been selected by the user
* @returns the selected text