Skip to content

Commit

Permalink
🐛 preserve letter ß in normalizeDiacritics
Browse files Browse the repository at this point in the history
Close #9
  • Loading branch information
VitorLuizC committed Feb 23, 2021
1 parent d82bc15 commit 8d9f0de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/normalizeDiacritics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ describe('normalizeDiacritics', () => {
).toEqual('aaaaaeeeeiiiiooooouuuuncAAAAAEEEEIIIIOOOOOUUUUNC');
});

it('Does not normalize special characters', () => {
it("Don't normalize special characters", () => {
expect(normalizeDiacritics('@_$><=-#!,.`\'"')).toEqual('@_$><=-#!,.`\'"');
});

it("Don't normalize german letter ß", () => {
expect(normalizeDiacritics('ß')).toEqual('ß');
});
});
2 changes: 1 addition & 1 deletion src/normalizeDiacritics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
const normalizeDiacritics = (text: string) =>
!!String.prototype.normalize
? text.normalize('NFKD').replace(/[\u0080-\uF8FF]/g, '')
? text.normalize('NFKD').replace(/[\u0300-\u036F]/g, '')
: text;

export default normalizeDiacritics;

0 comments on commit 8d9f0de

Please sign in to comment.