interface: changed alphabeticalOrder to ignore non-word characters

This commit is contained in:
Tyler Brown Cifu Shuster 2021-05-13 14:27:46 -07:00
parent f7aab5893c
commit 407bda3df5

View File

@ -278,8 +278,12 @@ export function cite(ship: string): string {
return `~${patp}`;
}
export function stripNonWord(string: string): string {
return string.replace(/[^\p{L}\p{N}\p{Z}]/gu, '');
}
export function alphabeticalOrder(a: string, b: string) {
return a.toLowerCase().localeCompare(b.toLowerCase());
return stripNonWord(a).toLowerCase().trim().localeCompare(stripNonWord(b).toLowerCase().trim());
}
export function lengthOrder(a: string, b: string) {