blob: 7b9530e78197a9dc28adb2beea5426c21e9e2b8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
export function match(search: string, target: string): boolean {
return search.split(/\s+/).every(s => format(target).includes(format(s)))
}
export function format(str: string): string {
return unaccent(str.toLowerCase())
}
function unaccent(str: string): string {
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "")
}
|