|
1 | 1 | /* eslint-disable no-eq-null, eqeqeq */ |
2 | | -"use strict"; |
3 | | - |
4 | 2 | function id(x) { |
5 | 3 | return x; |
6 | 4 | } |
7 | 5 |
|
8 | | -exports.fromBoolean = id; |
9 | | -exports.fromNumber = id; |
10 | | -exports.fromString = id; |
11 | | -exports.fromArray = id; |
12 | | -exports.fromObject = id; |
13 | | - |
14 | | -exports.jsonNull = null; |
| 6 | +export {id as fromBoolean}; |
| 7 | +export {id as fromNumber}; |
| 8 | +export {id as fromString}; |
| 9 | +export {id as fromArray}; |
| 10 | +export {id as fromObject}; |
| 11 | +export const jsonNull = null; |
15 | 12 |
|
16 | | -exports.stringify = function (j) { |
| 13 | +export function stringify(j) { |
17 | 14 | return JSON.stringify(j); |
18 | | -}; |
| 15 | +} |
19 | 16 |
|
20 | | -exports.stringifyWithIndent = function (i) { |
| 17 | +export function stringifyWithIndent(i) { |
21 | 18 | return function (j) { |
22 | 19 | return JSON.stringify(j, null, i); |
23 | 20 | }; |
24 | | -}; |
| 21 | +} |
25 | 22 |
|
26 | 23 | function isArray(a) { |
27 | 24 | return Object.prototype.toString.call(a) === "[object Array]"; |
28 | 25 | } |
29 | 26 |
|
30 | | -exports._caseJson = function (isNull, isBool, isNum, isStr, isArr, isObj, j) { |
| 27 | +export function _caseJson(isNull, isBool, isNum, isStr, isArr, isObj, j) { |
31 | 28 | if (j == null) return isNull(); |
32 | 29 | else if (typeof j === "boolean") return isBool(j); |
33 | 30 | else if (typeof j === "number") return isNum(j); |
34 | 31 | else if (typeof j === "string") return isStr(j); |
35 | 32 | else if (Object.prototype.toString.call(j) === "[object Array]") |
36 | 33 | return isArr(j); |
37 | 34 | else return isObj(j); |
38 | | -}; |
| 35 | +} |
39 | 36 |
|
40 | | -exports._compare = function _compare(EQ, GT, LT, a, b) { |
| 37 | +export function _compare(EQ, GT, LT, a, b) { |
41 | 38 | if (a == null) { |
42 | 39 | if (b == null) return EQ; |
43 | 40 | else return LT; |
@@ -102,4 +99,4 @@ exports._compare = function _compare(EQ, GT, LT, a, b) { |
102 | 99 | return EQ; |
103 | 100 | } |
104 | 101 | } |
105 | | -}; |
| 102 | +} |
0 commit comments