-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (32 loc) · 894 Bytes
/
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
const maps = require('./util/maps');
let mapName = "us";
module.exports = {
seMap: function (name) {
mapName = name.toLowerCase();
return this;
},
map: function (value) {
if (typeof value === 'number') {
if (value === undefined
|| maps[mapName] === undefined
|| maps[mapName][value] === undefined) {
return "";
}
return maps[mapName][value];
}
else {
var ev;
if (value)
ev = value;
else
ev = this.event;
if (ev === undefined
|| ev.which === undefined
|| maps[mapName] === undefined
|| maps[mapName][ev.which] === undefined) {
return "";
}
return maps[mapName][ev.which];
}
}
}