-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·105 lines (99 loc) · 2.03 KB
/
index.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
var platforms = [
{
regionTag: 'br',
platformId: 'BR1',
name: 'Brazil'
},
{
regionTag: 'eune',
platformId: 'EUN1',
name: 'Europe Nordic & East'
},
{
regionTag: 'euw',
platformId: 'EUW1',
name: 'Europe West'
},
{
regionTag: 'kr',
platformId: 'KR',
name: 'Korea'
},
{
regionTag: 'lan',
platformId: 'LA1',
name: 'Latin America North'
},
{
regionTag: 'las',
platformId: 'LA2',
name: 'Latin America South'
},
{
regionTag: 'na',
platformId: 'NA1',
name: 'North America'
},
{
regionTag: 'oce',
platformId: 'OC1',
name: 'Oceania'
},
{
regionTag: 'pbe',
platformId: 'PBE1',
name: 'Public Beta Environment'
},
{
regionTag: 'ph',
platformId: 'PH',
name: 'Phillipines'
},
{
regionTag: 'ru',
platformId: 'RU',
name: 'Russia'
},
{
regionTag: 'sg',
platformId: 'SG',
name: 'Singapore/Malaysia'
},
{
regionTag: 'th',
platformId: 'TH',
name: 'Thailand'
},
{
regionTag: 'tr',
platformId: 'TR1',
name: 'Turkey'
},
{
regionTag: 'tw',
platformId: 'TW',
name: 'Taiwan'
},
{
regionTag: 'vn',
platformId: 'VN',
name: 'Vietnam'
}
];
var tagToPlatformId = {};
var byPlatformId = {};
for (var i = 0; i < platforms.length; i++) {
tagToPlatformId[platforms[i].regionTag.toUpperCase()] = platforms[i].platformId;
byPlatformId[platforms[i].platformId] = platforms[i];
}
module.exports = function (serverString) {
if (typeof serverString !== 'string') return null;
var s = serverString.toUpperCase();
if (byPlatformId[s]) {
return byPlatformId[s];
}
else if (tagToPlatformId[s]) {
return byPlatformId[tagToPlatformId[s]];
}
return null;
};