Skip to content

Commit

Permalink
add getCleanName to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeftaei committed Jun 23, 2024
1 parent 9cfa43a commit 752e33e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ export function escapeDiscordMarkdown(string: string): string {
.replace(/[\\_~\*\|:#@><-]/g, "\\$&");
}

// TODO: write documentation for this
export function getCleanName(name: string) {
let cleanName = escapeDiscordMarkdown(name.replace(/𒐫𒈙/g, ""));
if (cleanName === "") {
if (name.length === 0) {
return "Lame Member";
} else {
return "\\" + name[0];
}
}
return cleanName;
}

/**
* A collection of sorting functions for strings.
*/
Expand Down

0 comments on commit 752e33e

Please sign in to comment.