Support non-Latin characters in library search function (#885)

* support multilingual library search

* prevent multiple spaces
This commit is contained in:
CrystailX
2025-02-26 00:56:00 +08:00
committed by GitHub
parent 52c8734c59
commit ae204b2a06

View File

@@ -10,7 +10,8 @@ export const baseCleanup = (str: string) => str.toLowerCase().trim();
export const enhancedCleanup = (str: string): string =>
baseCleanup(str)
.replace(/[^a-zA-Z0-9\\s]+/g, ' ')
.normalize('NFKC')
.replace(/[^\p{L}\p{N}]+/gu, ' ')
.trim();
export const reverseString = (str: string, separator: string = ''): string =>