-
Notifications
You must be signed in to change notification settings - Fork 65
/
enchantment.ts
63 lines (57 loc) · 1.2 KB
/
enchantment.ts
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
// enchantment.json generator
// deno run --allow-read --allow-write enchantment.ts
const REPLACEMENTS = {
"a": "ᔑ",
"b": "ʖ",
"c": "ᓵ",
"d": "↸",
"e": "ᒷ",
"f": "⎓",
"g": "⊣",
"h": "⍑",
"i": "╎",
"j": "⋮",
"k": "ꖌ",
"l": "ꖎ",
"m": "ᒲ",
"n": "リ",
"o": "𝙹",
"p": "!¡",
"q": "ᑑ",
"r": "∷",
"s": "ᓭ",
"t": "ℸ",
"u": "⚍",
"v": "⍊",
"w": "∴",
"x": "/",
"y": "||",
"z": "⨅"
}
function encode(input: string) {
return input.toLowerCase()
.split('')
.map(x => {
// @ts-expect-error a
if (REPLACEMENTS[x]) {
// @ts-expect-error a
return REPLACEMENTS[x]
}
return x;
})
.join('')
}
const text = await Deno.readTextFile("./en.json");
const data = JSON.parse(text);
function recurse(obj: { [key: string]: any }) {
for (const key of Object.keys(obj)) {
if (key === 'dayjs') continue;
if (typeof obj[key] === 'object') {
recurse(obj[key]);
} else {
obj[key] = encode(obj[key]);
}
}
}
recurse(data);
await Deno.writeTextFile("./enchantment.json", JSON.stringify(data, null, 4));