-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuzz.js
32 lines (32 loc) · 863 Bytes
/
fuzz.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
export default function fuzzy(word) {
word = word
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/\s/g, "")
.replace(/w/gi, "v")
.replace(/oo/gi, "u")
.replace(/ee/gi, "i")
.replace(/kh/gi, "k")
.replace(/gh/gi, "g")
.replace(/ch/gi, "c")
.replace(/jh/gi, "j")
.replace(/th/gi, "t")
.replace(/dh/gi, "d")
.replace(/ph/gi, "p")
.replace(/bh/gi, "b")
.replace(/kk/gi, "k")
.replace(/gg/gi, "g")
.replace(/cc/gi, "c")
.replace(/jj/gi, "j")
.replace(/tt/gi, "t")
.replace(/dd/gi, "d")
.replace(/pp/gi, "p")
.replace(/bb/gi, "b")
.replace(/mm/gi, "m")
.replace(/yy/gi, "y")
.replace(/rr/gi, "r")
.replace(/ll/gi, "l")
.replace(/vv/gi, "v")
.replace(/ss/gi, "s");
return word;
}