Skip to content

Commit

Permalink
fix: toSlug func
Browse files Browse the repository at this point in the history
  • Loading branch information
TopETH committed Apr 12, 2024
1 parent 85161a7 commit 79b1cf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/masterbots.ai/lib/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const SlugSchema: ZodSchema<string> = z.string()
export const toSlug = (username: string, separator: string): string => {
return username
.toLowerCase()
.replace(/&/g, '_')
.replace(/ & /g, '_')
.replace(/&/g, 'n')
.replace(/ & /g, 'n')
.replace(/[^a-z0-9_]/g, separator)
}

Expand Down
8 changes: 4 additions & 4 deletions packages/mb-lib/src/text/text.lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export function toSlug(str: string): string {
return "";
}
s = s.toLowerCase().trim();
s = s.replace(/ & /g, " and ");
s = s.replace(/[ ]+/g, "-");
s = s.replace(/[-]+/g, "-");
s = s.replace(/[^a-z0-9-]+/g, "");
s = s.replace(/\&/g, "n");
s = s.replace(/[ ]+/g, "_");
s = s.replace(/[-]+/g, "_");
s = s.replace(/[^a-z0-9_]+/g, "");
return s;
}

0 comments on commit 79b1cf3

Please sign in to comment.