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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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