mirror of
https://github.com/spliit-app/spliit.git
synced 2026-02-21 06:56:12 +01:00
Increase fuzzines of search results (#187)
* Introduce normalizeString fn * Prettier --------- Co-authored-by: Sebastien Castiel <sebastien@castiel.me>
This commit is contained in:
@@ -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, '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user