You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Remove the compare function from utils (#4315)
* Remove the compare function from utils and change the one use of it to just intantiate a collator and use it. This was marked as internal module so this shouldn't be a breaking change. Of course, react-sdk was using it. Requires: https://github.com/matrix-org/matrix-react-sdk/pull/12782 * Add simple not-a-perf-test test * recalculate repeatedly otherwise we aren't testing anything different * Use fewer members as it was making the test take a bit too long
This commit is contained in:
10
src/utils.ts
10
src/utils.ts
@@ -649,16 +649,6 @@ export function lexicographicCompare(a: string, b: string): number {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is similar to Object.assign() but it assigns recursively and
|
||||
* allows you to ignore nullish values from the source
|
||||
|
||||
Reference in New Issue
Block a user