-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaaia.ts
50 lines (47 loc) · 852 Bytes
/
aaia.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
interface alphabet {
[name: string]: string
}
const abc:alphabet = {
A: 'Alfa',
B: 'Bravo',
C: 'Charlie',
D: 'Delta',
E: 'Echo',
F: 'Foxtrot',
G: 'Golf',
H: 'Hotel',
I: 'India',
J: 'Juliett',
K: 'Kilo',
L: 'Lima',
M: 'Mike',
N: 'November',
O: 'Oscar',
P: 'Papa',
Q: 'Quebec',
R: 'Romeo',
S: 'Sierra',
T: 'Tango',
U: 'Uniform',
V: 'Victor',
W: 'Whiskey',
X: 'X-ray',
Y: 'Yankee',
Z: 'Zulu',
};
function aaia(input: string) {
const char = input.toUpperCase().trim().split('');
const output = [];
for (let index = 0; index < char.length; index += 1) {
const element = char[index];
if (abc[element]) {
output.push(abc[element]);
} else if (element === ' ') {
output.push(null);
} else {
output.push(element);
}
}
return output;
}
export default aaia;