Support non-Latin characters in library search function (#885)
* support multilingual library search * prevent multiple spaces
This commit is contained in:
@@ -10,7 +10,8 @@ export const baseCleanup = (str: string) => str.toLowerCase().trim();
|
|||||||
|
|
||||||
export const enhancedCleanup = (str: string): string =>
|
export const enhancedCleanup = (str: string): string =>
|
||||||
baseCleanup(str)
|
baseCleanup(str)
|
||||||
.replace(/[^a-zA-Z0-9\\s]+/g, ' ')
|
.normalize('NFKC')
|
||||||
|
.replace(/[^\p{L}\p{N}]+/gu, ' ')
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
export const reverseString = (str: string, separator: string = ''): string =>
|
export const reverseString = (str: string, separator: string = ''): string =>
|
||||||
|
|||||||
Reference in New Issue
Block a user