-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathjs_json.js
111 lines (93 loc) · 2.02 KB
/
js_json.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
106
107
108
109
110
111
'use strict';
var $$Array = require("./array");
function reify_type(x) {
return /* tuple */[
typeof x === "string" ? /* String */0 : (
typeof x === "number" ? /* Number */1 : (
typeof x === "boolean" ? /* Boolean */4 : (
x === null ? /* Null */5 : (
Array.isArray(x) ? /* Array */3 : /* Object */2
)
)
)
),
x
];
}
function test(x, v) {
switch (v) {
case 0 :
return +(typeof x === "string");
case 1 :
return +(typeof x === "number");
case 2 :
if (x !== null && typeof x === "object") {
return 1 - +Array.isArray(x);
}
else {
return /* false */0;
}
case 3 :
return +Array.isArray(x);
case 4 :
return +(typeof x === "boolean");
case 5 :
return +(x === null);
}
}
var $$null$1 = null;
function string(s) {
return s;
}
function number(f) {
return f;
}
function numberOfInt(i) {
return i;
}
function $$boolean(b) {
if (b) {
return true;
}
else {
return false;
}
}
function object_(o) {
return o;
}
function array_(a) {
return a;
}
function stringArray(a) {
return a;
}
function numberArray(a) {
return a;
}
function intArray(a) {
return a;
}
function booleanArray(a) {
return $$Array.map($$boolean, a);
}
function objectArray(a) {
return a;
}
var reifyType = reify_type;
exports.reify_type = reify_type;
exports.reifyType = reifyType;
exports.test = test;
exports.$$null = $$null$1;
exports.string = string;
exports.number = number;
exports.numberOfInt = numberOfInt;
exports.$$boolean = $$boolean;
exports.object_ = object_;
exports.array_ = array_;
exports.stringArray = stringArray;
exports.numberArray = numberArray;
exports.intArray = intArray;
exports.booleanArray = booleanArray;
exports.objectArray = objectArray;
/* null Not a pure module */