Skip to content

Commit

Permalink
fix(slug): Remove trademark symbols from normalized strings
Browse files Browse the repository at this point in the history
  • Loading branch information
gdarchen committed Oct 12, 2023
1 parent 2463769 commit 33a3a49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/normalize-string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('normalizeString()', () => {
it('strips non-alphanumeric characters', () => {
expect(normalizeString('hi!!!')).toBe('hi');
expect(normalizeString('who? me?')).toBe('who me');
expect(normalizeString('!"£$%^&*()+[]{};:@#~?/,|\\><`¬\'=')).toBe('');
expect(normalizeString('!"£$%^&*()+[]{};:@#~?/,|\\><`¬\'=©®™')).toBe('');
});

it('allows a subset of non-alphanumeric characters to pass through', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/normalize-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export function normalizeString(input: string, spaceReplacer = ' '): string {
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
.replace(/[!"£$%^&*()+[\]{};:@#~?\\/,|><`¬'=‘’]/g, '')
.replace(/[!"£$%^&*()+[\]{};:@#~?\\/,|><`¬'=‘’©®™]/g, '')
.replace(/\s+/g, spaceReplacer);
}

0 comments on commit 33a3a49

Please sign in to comment.