mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +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}`;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user