-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathjs_types.js
79 lines (74 loc) · 1.5 KB
/
js_types.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
'use strict';
function reify_type(x) {
if (typeof x === "undefined") {
return /* tuple */[
/* Undefined */0,
x
];
}
else if (typeof x === "null") {
return /* tuple */[
/* Null */1,
x
];
}
else if (typeof x === "number") {
return /* tuple */[
/* Number */3,
x
];
}
else if (typeof x === "string") {
return /* tuple */[
/* String */4,
x
];
}
else if (typeof x === "boolean") {
return /* tuple */[
/* Boolean */2,
x
];
}
else if (typeof x === "function") {
return /* tuple */[
/* Function */5,
x
];
}
else if (typeof x === "object") {
return /* tuple */[
/* Object */6,
x
];
}
else {
return /* tuple */[
/* Symbol */7,
x
];
}
}
function test(x, v) {
switch (v) {
case 0 :
return +(typeof x === "undefined");
case 1 :
return +(typeof x === "Js.null");
case 2 :
return +(typeof x === "boolean");
case 3 :
return +(typeof x === "number");
case 4 :
return +(typeof x === "string");
case 5 :
return +(typeof x === "function");
case 6 :
return +(typeof x === "object");
case 7 :
return +(typeof x === "symbol");
}
}
exports.reify_type = reify_type;
exports.test = test;
/* No side effect */