feat: match ae/oe ligatures in normalization
This commit is contained in:
@@ -11,6 +11,8 @@ export interface Matchable {
|
|||||||
export function normalize(input: string): string {
|
export function normalize(input: string): string {
|
||||||
return input
|
return input
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
.replace(/æ/g, 'ae')
|
||||||
|
.replace(/œ/g, 'oe')
|
||||||
.normalize('NFKD')
|
.normalize('NFKD')
|
||||||
.replace(/[\u0300-\u036f]/g, '')
|
.replace(/[\u0300-\u036f]/g, '')
|
||||||
.replace(/[^\p{L}\p{N}\s]/gu, ' ')
|
.replace(/[^\p{L}\p{N}\s]/gu, ' ')
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ describe('normalize', () => {
|
|||||||
expect(normalize(' Blur: The Best of… ')).toBe('blur best of')
|
expect(normalize(' Blur: The Best of… ')).toBe('blur best of')
|
||||||
expect(normalize('Björk — Début')).toBe('bjork debut')
|
expect(normalize('Björk — Début')).toBe('bjork debut')
|
||||||
expect(normalize('A Tribe Called Quest')).toBe('tribe called quest')
|
expect(normalize('A Tribe Called Quest')).toBe('tribe called quest')
|
||||||
|
expect(normalize('Ænima')).toBe('aenima')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user