-
Notifications
You must be signed in to change notification settings - Fork 0
/
20.ts
31 lines (29 loc) · 1.19 KB
/
20.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
type Letters = {
A: ["█▀█ ", "█▀█ ", "▀ ▀ "];
B: ["█▀▄ ", "█▀▄ ", "▀▀ "];
C: ["█▀▀ ", "█ ░░", "▀▀▀ "];
E: ["█▀▀ ", "█▀▀ ", "▀▀▀ "];
H: ["█ █ ", "█▀█ ", "▀ ▀ "];
I: ["█ ", "█ ", "▀ "];
M: ["█▄░▄█ ", "█ ▀ █ ", "▀ ░░▀ "];
N: ["█▄░█ ", "█ ▀█ ", "▀ ░▀ "];
P: ["█▀█ ", "█▀▀ ", "▀ ░░"];
R: ["█▀█ ", "██▀ ", "▀ ▀ "];
S: ["█▀▀ ", "▀▀█ ", "▀▀▀ "];
T: ["▀█▀ ", "░█ ░", "░▀ ░"];
Y: ["█ █ ", "▀█▀ ", "░▀ ░"];
W: ["█ ░░█ ", "█▄▀▄█ ", "▀ ░ ▀ "];
" ": ["░", "░", "░"];
":": ["#", "░", "#"];
"*": ["░", "#", "░"];
};
type BuildRow<T extends string, Res extends string[] = ["", "", ""]> = T extends `${infer L extends
keyof Letters}${infer R}`
? BuildRow<
R,
[`${Res[0]}${Letters[L][0]}`, `${Res[1]}${Letters[L][1]}`, `${Res[2]}${Letters[L][2]}`]
>
: Res;
type ToAsciiArt<T extends string, Res extends string[] = []> = T extends `${infer L}\n${infer R}`
? ToAsciiArt<R, [...Res, ...BuildRow<Uppercase<L>>]>
: [...Res, ...BuildRow<Uppercase<T>>];