-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencode.js
119 lines (113 loc) · 3.83 KB
/
encode.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
function encode (value) {
// Collapse all lowercase ᏣᎳᎩ to uppercase
value = value.toUpperCase()
// Collapse curly quotes
value = value.replace(/\“/g,"\"")
value = value.replace(/\”/g,"\"")
value = value.replace(/\‘/g,"\'")
value = value.replace(/\’/g,"\'")
// Numbers
value = value.replace(/0/g,"u")
value = value.replace(/1/g,"'")
value = value.replace(/2/g,"M")
value = value.replace(/3/g,"(")
value = value.replace(/4/g,"X")
value = value.replace(/5/g,"d")
value = value.replace(/6/g,"x")
value = value.replace(/7/g,")")
value = value.replace(/8/g,"H")
value = value.replace(/9/g,"w")
// Punctuation
value = value.replace(/\./g,"#")
value = value.replace(/\"/g,"$")
value = value.replace(/,/g,"\"")
value = value.replace(/:/g,"%")
value = value.replace(/\?/g,"&")
// Syllabary
value = value.replace(/Ꭰ/g,"*")
value = value.replace(/Ꭱ/g,"+")
value = value.replace(/Ꭲ/g,",")
value = value.replace(/Ꭳ/g,"-")
value = value.replace(/Ꭴ/g,".")
value = value.replace(/Ꭵ/g,"/")
value = value.replace(/Ꭶ/g,"0")
value = value.replace(/Ꭷ/g,"1")
value = value.replace(/Ꭸ/g,"2")
value = value.replace(/Ꭹ/g,"3")
value = value.replace(/Ꭺ/g,"4")
value = value.replace(/Ꭻ/g,"5")
value = value.replace(/Ꭼ/g,"6")
value = value.replace(/Ꭽ/g,"7")
value = value.replace(/Ꭾ/g,"8")
value = value.replace(/Ꭿ/g,"9")
value = value.replace(/Ꮀ/g,":")
value = value.replace(/Ꮁ/g,";")
value = value.replace(/Ꮂ/g,"<")
value = value.replace(/Ꮃ/g,"=")
value = value.replace(/Ꮄ/g,">")
value = value.replace(/Ꮅ/g,"?")
value = value.replace(/Ꮆ/g,"@")
value = value.replace(/Ꮇ/g,"A")
value = value.replace(/Ꮈ/g,"B")
value = value.replace(/Ꮉ/g,"C")
value = value.replace(/Ꮊ/g,"D")
value = value.replace(/Ꮋ/g,"E")
value = value.replace(/Ꮌ/g,"F")
value = value.replace(/Ꮍ/g,"G")
value = value.replace(/Ꮎ/g,"H")
value = value.replace(/Ꮏ/g,"I")
value = value.replace(/Ꮐ/g,"J")
value = value.replace(/Ꮑ/g,"K")
value = value.replace(/Ꮒ/g,"L")
value = value.replace(/Ꮓ/g,"M")
value = value.replace(/Ꮔ/g,"N")
value = value.replace(/Ꮕ/g,"O")
value = value.replace(/Ꮖ/g,"P")
value = value.replace(/Ꮚ/g,"Q")
value = value.replace(/Ꮘ/g,"R")
value = value.replace(/Ꮙ/g,"S")
value = value.replace(/Ꮚ/g,"T")
value = value.replace(/Ꮛ/g,"U")
value = value.replace(/Ꮝ/g,"V")
value = value.replace(/Ꮜ/g,"W")
value = value.replace(/Ꮞ/g,"X")
value = value.replace(/Ꮟ/g,"Y")
value = value.replace(/Ꮠ/g,"Z")
value = value.replace(/Ꮡ/g,"[")
value = value.replace(/Ꮢ/g,"/")
value = value.replace(/Ꮣ/g,"]")
value = value.replace(/Ꮤ/g,"^")
value = value.replace(/Ꮥ/g,"_")
value = value.replace(/Ꮦ/g,"`")
value = value.replace(/Ꮧ/g,"a")
value = value.replace(/Ꮨ/g,"b")
value = value.replace(/Ꮩ/g,"c")
value = value.replace(/Ꮪ/g,"d")
value = value.replace(/Ꮫ/g,"e")
value = value.replace(/Ꮬ/g,"f")
value = value.replace(/Ꮭ/g,"g")
value = value.replace(/Ꮮ/g,"h")
value = value.replace(/Ꮯ/g,"i")
value = value.replace(/Ꮰ/g,"j")
value = value.replace(/Ꮱ/g,"k")
value = value.replace(/Ꮲ/g,"l")
value = value.replace(/Ꮳ/g,"m")
value = value.replace(/Ꮴ/g,"n")
value = value.replace(/Ꮵ/g,"o")
value = value.replace(/Ꮶ/g,"p")
value = value.replace(/Ꮷ/g,"q")
value = value.replace(/Ꮸ/g,"r")
value = value.replace(/Ꮹ/g,"s")
value = value.replace(/Ꮺ/g,"t")
value = value.replace(/Ꮻ/g,"u")
value = value.replace(/Ꮼ/g,"v")
value = value.replace(/Ꮽ/g,"w")
value = value.replace(/Ꮾ/g,"x")
value = value.replace(/Ꮿ/g,"y")
value = value.replace(/Ᏸ/g,"z")
value = value.replace(/Ᏹ/g,"{")
value = value.replace(/Ᏺ/g,"|")
value = value.replace(/Ᏻ/g,"}")
value = value.replace(/Ᏼ/g,"~")
return value
}