mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-14 04:19:22 +03:00
interface: changed alphabeticalOrder to ignore non-word characters
This commit is contained in:
parent
f7aab5893c
commit
407bda3df5
@ -278,8 +278,12 @@ export function cite(ship: string): string {
|
|||||||
return `~${patp}`;
|
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) {
|
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) {
|
export function lengthOrder(a: string, b: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user