Increase fuzzines of search results (#187)

* Introduce normalizeString fn

* Prettier

---------

Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
This commit is contained in:
Sergio Behrends
2024-08-02 16:57:18 +02:00
committed by GitHub
parent e990e00a75
commit 7145cb6f30
2 changed files with 15 additions and 2 deletions

View File

@@ -48,3 +48,13 @@ export function formatFileSize(size: number) {
if (size > 1024) return `${formatNumber(size / 1024)} kB`
return `${formatNumber(size)} B`
}
export function normalizeString(input: string): string {
// Replaces special characters
// Input: áäåèéę
// Output: aaaeee
return input
.toLowerCase()
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
}