ejv 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -67
- package/LICENSE +21 -21
- package/README-KR.md +591 -591
- package/README.md +595 -595
- package/build/constants.d.ts +104 -104
- package/build/constants.js +118 -118
- package/build/ejv.d.ts +2 -2
- package/build/ejv.js +686 -684
- package/build/ejv.js.map +1 -1
- package/build/interfaces.d.ts +38 -38
- package/build/interfaces.js +14 -14
- package/build/public_api.d.ts +3 -3
- package/build/public_api.js +13 -13
- package/build/tester.d.ts +34 -34
- package/build/tester.js +268 -268
- package/build/tester.js.map +1 -1
- package/build/util.d.ts +1 -1
- package/build/util.js +67 -65
- package/build/util.js.map +1 -1
- package/package.json +39 -39
- package/spec/common-test-runner.ts +17 -17
- package/spec/ejv.spec.ts +4634 -4634
- package/spec/testers.spec.ts +832 -832
- package/src/constants.ts +155 -155
- package/src/ejv.ts +1071 -1071
- package/src/interfaces.ts +63 -63
- package/src/public_api.ts +2 -2
- package/src/tester.ts +302 -302
- package/src/util.ts +58 -58
- package/tsconfig.json +18 -18
- package/tsconfig.spec.json +18 -18
package/build/util.js
CHANGED
|
@@ -1,66 +1,68 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
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
|
-
case '
|
|
33
|
-
case '
|
|
34
|
-
case '
|
|
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
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.clone = void 0;
|
|
13
|
+
var clone = function (obj) {
|
|
14
|
+
var result = null;
|
|
15
|
+
if (!!obj) {
|
|
16
|
+
var type = typeof obj;
|
|
17
|
+
if (type === 'object') {
|
|
18
|
+
if (obj.push !== undefined && typeof obj.push === 'function') {
|
|
19
|
+
type = 'array';
|
|
20
|
+
}
|
|
21
|
+
else if (obj.getFullYear !== undefined && typeof obj.getFullYear === 'function') {
|
|
22
|
+
type = 'date';
|
|
23
|
+
}
|
|
24
|
+
else if (obj.byteLength !== undefined) {
|
|
25
|
+
type = 'buffer';
|
|
26
|
+
}
|
|
27
|
+
else if (obj.exec !== undefined && obj.test !== undefined) {
|
|
28
|
+
type = 'regexp';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
switch (type) {
|
|
32
|
+
case 'boolean':
|
|
33
|
+
case 'number':
|
|
34
|
+
case 'function':
|
|
35
|
+
case 'string':
|
|
36
|
+
case 'buffer':
|
|
37
|
+
// ok with simple copy
|
|
38
|
+
result = obj;
|
|
39
|
+
break;
|
|
40
|
+
case 'regexp':
|
|
41
|
+
result = new RegExp(obj);
|
|
42
|
+
break;
|
|
43
|
+
case 'date':
|
|
44
|
+
result = new Date(obj);
|
|
45
|
+
break;
|
|
46
|
+
case 'array':
|
|
47
|
+
result = __spreadArray([], obj.map(function (one) {
|
|
48
|
+
return (0, exports.clone)(one);
|
|
49
|
+
}), true);
|
|
50
|
+
break;
|
|
51
|
+
case 'object':
|
|
52
|
+
// sanitize default false
|
|
53
|
+
result = {};
|
|
54
|
+
Object.keys(obj)
|
|
55
|
+
.forEach(function (key) {
|
|
56
|
+
// recursively call
|
|
57
|
+
result[key] = (0, exports.clone)(obj[key]);
|
|
58
|
+
});
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
result = obj; // do not copy null & undefined
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
exports.clone = clone;
|
|
66
68
|
//# sourceMappingURL=util.js.map
|
package/build/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAO,IAAM,KAAK,GAAG,UAAC,GAAS;IAC9B,IAAI,MAAM,GAAS,IAAI,CAAC;IAExB,IAAI,CAAC,CAAC,GAAG,EAAE;QACV,IAAI,IAAI,GAAY,OAAO,GAAG,CAAC;QAE/B,IAAI,IAAI,KAAK,QAAQ,EAAE;YACtB,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE;gBAC7D,IAAI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CAAC,CAAC,+BAA+B;KAC7C;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AA1DW,QAAA,KAAK,SA0DhB"}
|
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ejv",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"description": "Easy JSON Validator",
|
|
5
|
-
"main": "build/public_api.js",
|
|
6
|
-
"types": "build/public_api.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"clean": "rimraf ./build",
|
|
9
|
-
"prebuild": "yarn clean",
|
|
10
|
-
"build": "tsc",
|
|
11
|
-
"prebuild:test": "yarn clean",
|
|
12
|
-
"build:test": "tsc -p tsconfig.spec.json",
|
|
13
|
-
"pretest": "yarn build:test",
|
|
14
|
-
"test": "mocha ./build/**/*.spec.js"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/han41858/ejv.git"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"json",
|
|
22
|
-
"validator",
|
|
23
|
-
"validation"
|
|
24
|
-
],
|
|
25
|
-
"author": "Janghyun Han <han41858@gmail.com>",
|
|
26
|
-
"license": "MIT",
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://github.com/han41858/ejv/issues"
|
|
29
|
-
},
|
|
30
|
-
"homepage": "https://github.com/han41858/ejv#readme",
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@types/chai": "^4.2.14",
|
|
33
|
-
"@types/mocha": "^8.2.0",
|
|
34
|
-
"chai": "^4.2.0",
|
|
35
|
-
"mocha": "^8.2.1",
|
|
36
|
-
"rimraf": "^3.0.2",
|
|
37
|
-
"typescript": "^4.1.3"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ejv",
|
|
3
|
+
"version": "1.1.11",
|
|
4
|
+
"description": "Easy JSON Validator",
|
|
5
|
+
"main": "build/public_api.js",
|
|
6
|
+
"types": "build/public_api.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rimraf ./build",
|
|
9
|
+
"prebuild": "yarn clean",
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"prebuild:test": "yarn clean",
|
|
12
|
+
"build:test": "tsc -p tsconfig.spec.json",
|
|
13
|
+
"pretest": "yarn build:test",
|
|
14
|
+
"test": "mocha ./build/**/*.spec.js"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/han41858/ejv.git"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"json",
|
|
22
|
+
"validator",
|
|
23
|
+
"validation"
|
|
24
|
+
],
|
|
25
|
+
"author": "Janghyun Han <han41858@gmail.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/han41858/ejv/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/han41858/ejv#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/chai": "^4.2.14",
|
|
33
|
+
"@types/mocha": "^8.2.0",
|
|
34
|
+
"chai": "^4.2.0",
|
|
35
|
+
"mocha": "^8.2.1",
|
|
36
|
+
"rimraf": "^3.0.2",
|
|
37
|
+
"typescript": "^4.1.3"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// to test common type easily
|
|
2
|
-
export const commonTestRunner = (testFnc,
|
|
3
|
-
nullResult : boolean,
|
|
4
|
-
undefinedResult : boolean,
|
|
5
|
-
booleanResult : boolean,
|
|
6
|
-
numberResult : boolean,
|
|
7
|
-
stringResult : boolean,
|
|
8
|
-
arrayResult : boolean,
|
|
9
|
-
objectResult : boolean) : boolean => {
|
|
10
|
-
return testFnc(null) === nullResult
|
|
11
|
-
&& testFnc(undefined) === undefinedResult
|
|
12
|
-
&& testFnc(true) === booleanResult
|
|
13
|
-
&& testFnc(8) === numberResult
|
|
14
|
-
&& testFnc('hello') === stringResult
|
|
15
|
-
&& testFnc([1, 2, 3]) === arrayResult
|
|
16
|
-
&& testFnc({ a : 1 }) === objectResult;
|
|
17
|
-
};
|
|
1
|
+
// to test common type easily
|
|
2
|
+
export const commonTestRunner = (testFnc,
|
|
3
|
+
nullResult : boolean,
|
|
4
|
+
undefinedResult : boolean,
|
|
5
|
+
booleanResult : boolean,
|
|
6
|
+
numberResult : boolean,
|
|
7
|
+
stringResult : boolean,
|
|
8
|
+
arrayResult : boolean,
|
|
9
|
+
objectResult : boolean) : boolean => {
|
|
10
|
+
return testFnc(null) === nullResult
|
|
11
|
+
&& testFnc(undefined) === undefinedResult
|
|
12
|
+
&& testFnc(true) === booleanResult
|
|
13
|
+
&& testFnc(8) === numberResult
|
|
14
|
+
&& testFnc('hello') === stringResult
|
|
15
|
+
&& testFnc([1, 2, 3]) === arrayResult
|
|
16
|
+
&& testFnc({ a : 1 }) === objectResult;
|
|
17
|
+
};
|