ejv 1.1.11 → 2.0.1

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.
Files changed (75) hide show
  1. package/.eslintrc.json +88 -0
  2. package/.mocharc.json +8 -0
  3. package/CHANGELOG.md +109 -68
  4. package/LICENSE +21 -21
  5. package/README-KR.md +596 -592
  6. package/README.md +599 -595
  7. package/build/{constants.js → cjs/constants.js} +45 -46
  8. package/build/cjs/constants.js.map +1 -0
  9. package/build/cjs/ejv.js +1263 -0
  10. package/build/cjs/ejv.js.map +1 -0
  11. package/build/{public_api.js → cjs/index.js} +4 -4
  12. package/build/cjs/index.js.map +1 -0
  13. package/build/cjs/interfaces.js +29 -0
  14. package/build/cjs/interfaces.js.map +1 -0
  15. package/build/cjs/package.json +1 -0
  16. package/build/{tester.js → cjs/tester.js} +88 -83
  17. package/build/cjs/tester.js.map +1 -0
  18. package/build/cjs/util.js +103 -0
  19. package/build/cjs/util.js.map +1 -0
  20. package/build/constants.d.ts +37 -40
  21. package/build/esm/constants.js +115 -0
  22. package/build/esm/constants.js.map +1 -0
  23. package/build/esm/ejv.js +1261 -0
  24. package/build/esm/ejv.js.map +1 -0
  25. package/build/esm/index.js +4 -0
  26. package/build/esm/index.js.map +1 -0
  27. package/build/esm/interfaces.js +33 -0
  28. package/build/esm/interfaces.js.map +1 -0
  29. package/build/esm/package.json +1 -0
  30. package/build/esm/tester.js +240 -0
  31. package/build/esm/tester.js.map +1 -0
  32. package/build/esm/util.js +96 -0
  33. package/build/esm/util.js.map +1 -0
  34. package/build/index.d.ts +3 -0
  35. package/build/interfaces.d.ts +51 -13
  36. package/build/scripts/add-js-extensions.js +46 -0
  37. package/build/scripts/add-js-extensions.js.map +1 -0
  38. package/build/tester.d.ts +16 -17
  39. package/build/util.d.ts +7 -1
  40. package/package.json +50 -39
  41. package/scripts/add-js-extensions.ts +59 -0
  42. package/spec/ArrayScheme.ts +1021 -0
  43. package/spec/CommonScheme.ts +251 -0
  44. package/spec/DateScheme.ts +472 -0
  45. package/spec/NumberScheme.ts +1032 -0
  46. package/spec/ObjectScheme.ts +499 -0
  47. package/spec/RegExpScheme.ts +112 -0
  48. package/spec/StringScheme.ts +1239 -0
  49. package/spec/common-test-util.ts +63 -0
  50. package/spec/ejv.spec.ts +209 -4634
  51. package/spec/testers.spec.ts +833 -832
  52. package/src/constants.ts +155 -156
  53. package/src/ejv.ts +1648 -1071
  54. package/src/index.ts +14 -0
  55. package/src/interfaces.ts +145 -63
  56. package/src/tester.ts +308 -302
  57. package/src/util.ts +124 -59
  58. package/tsconfig.cjs.json +8 -0
  59. package/tsconfig.esm.json +7 -0
  60. package/tsconfig.json +22 -19
  61. package/tsconfig.scripts.json +14 -0
  62. package/tsconfig.types.json +9 -0
  63. package/build/constants.js.map +0 -1
  64. package/build/ejv.js +0 -687
  65. package/build/ejv.js.map +0 -1
  66. package/build/interfaces.js +0 -15
  67. package/build/interfaces.js.map +0 -1
  68. package/build/public_api.d.ts +0 -3
  69. package/build/public_api.js.map +0 -1
  70. package/build/tester.js.map +0 -1
  71. package/build/util.js +0 -68
  72. package/build/util.js.map +0 -1
  73. package/spec/common-test-runner.ts +0 -17
  74. package/src/public_api.ts +0 -3
  75. package/tsconfig.spec.json +0 -19
package/.eslintrc.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "eslint:recommended",
9
+ "plugin:@typescript-eslint/recommended"
10
+ ],
11
+ "parser": "@typescript-eslint/parser",
12
+ "parserOptions": {
13
+ "ecmaVersion": 2020,
14
+ "sourceType": "module"
15
+ },
16
+ "plugins": [
17
+ "@typescript-eslint"
18
+ ],
19
+ "rules": {
20
+ "indent": "off",
21
+ "@typescript-eslint/indent": [
22
+ "warn",
23
+ "tab",
24
+ {
25
+ "ignoreComments": true,
26
+ "SwitchCase": 1,
27
+ "ignoredNodes": [
28
+ "CallExpression *",
29
+ "ExpressionStatement *"
30
+ ]
31
+ }
32
+ ],
33
+ "linebreak-style": [
34
+ "warn",
35
+ "windows"
36
+ ],
37
+ "arrow-parens": "warn",
38
+ "quotes": [
39
+ "warn",
40
+ "single"
41
+ ],
42
+ "semi": [
43
+ "warn",
44
+ "always"
45
+ ],
46
+ "no-shadow": "off",
47
+ "@typescript-eslint/no-shadow": "warn",
48
+ "no-trailing-spaces": "warn",
49
+ "no-var": "warn",
50
+ "prefer-const": "warn",
51
+ "space-before-function-paren": "warn",
52
+ "brace-style": [
53
+ "warn",
54
+ "stroustrup"
55
+ ],
56
+ "key-spacing": [
57
+ "warn",
58
+ {
59
+ "beforeColon": false,
60
+ "afterColon": true
61
+ }
62
+ ],
63
+ "@typescript-eslint/type-annotation-spacing": [
64
+ "warn",
65
+ {
66
+ "before": false,
67
+ "after": true,
68
+ "overrides": {
69
+ "arrow": {
70
+ "before": true,
71
+ "after": true
72
+ }
73
+ }
74
+ }
75
+ ],
76
+ "@typescript-eslint/explicit-function-return-type": "warn",
77
+ "@typescript-eslint/no-inferrable-types": "off",
78
+ "@typescript-eslint/no-non-null-assertion": "warn",
79
+ "@typescript-eslint/no-empty-function": "warn",
80
+ "@typescript-eslint/no-unused-vars": "warn",
81
+ "@typescript-eslint/explicit-module-boundary-types": "warn",
82
+ "operator-linebreak": [
83
+ "warn",
84
+ "before"
85
+ ],
86
+ "no-param-reassign": "warn"
87
+ }
88
+ }
package/.mocharc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "require": [
3
+ "ts-node/register"
4
+ ],
5
+ "spec": [
6
+ "spec/**/*.ts"
7
+ ]
8
+ }
package/CHANGELOG.md CHANGED
@@ -1,68 +1,109 @@
1
- # Change Log
2
-
3
- # 1.1.7
4
-
5
- - improvement
6
-
7
- - array error message format
8
-
9
- - bug fix
10
-
11
- - array temp key error fixed
12
-
13
- - dependency packages version up
14
-
15
- - TypeScript@3.8.3
16
- - mocha@7.1.0
17
-
18
-
19
- # 1.1.6
20
-
21
- - improvement
22
-
23
- - `data` represent entire data passed to `ejv()`
24
- - `errorData` added to `EjvError`
25
- - `Function` declaration removed
26
-
27
- - bug fix
28
-
29
- - timezone error fixed
30
-
31
-
32
- # 1.1.5
33
-
34
- - improvement
35
-
36
- - `null`, `undefined` flow optimized
37
-
38
- - bug fix
39
-
40
- - `null` parsing error fixed
41
-
42
-
43
- # 1.1.4
44
-
45
- - improvement
46
-
47
- - array item `nullable` logic added
48
-
49
-
50
- # 1.1.3
51
-
52
- - improvement
53
-
54
- - array error path format
55
-
56
-
57
- # 1.1.2
58
-
59
- - bug fix
60
-
61
- - ITEMS_SCHEMES bug fixed
62
-
63
-
64
- # 1.1.1
65
-
66
- - improvement
67
-
68
- - `ErrorType.ITEMS_SCHEME` deprecated
1
+ # Change Log
2
+
3
+ # 2.0.1
4
+
5
+ - improvement
6
+ - `ejv()` does not throw error, just return `EjvError` object
7
+ - `EjvError` - `isSchemeError`, `isDataError` properties added
8
+ - `ErrorType`, `ErrorMsg` - `ONE_OF` renamed to `ONE_VALUE_OF`
9
+ - esm build added
10
+ - types : `build`
11
+ - esm : `build/esm`
12
+ - commonjs : `build/cjs`
13
+ - dependency packages version up
14
+ - `typescript@5.3.3`
15
+
16
+ # 1.1.11
17
+
18
+ - improvement
19
+ - `eslint` added
20
+ - `Scheme` interface subdivided with each type
21
+ - new
22
+ schemes: `BooleanScheme`, `NumberScheme`, `StringScheme`, `ObjectScheme`, `DateScheme`, `RegExpScheme`, `ArrayScheme`
23
+ - specs subdivided
24
+ - `not` rule added, but finally removed
25
+ - `eslint` rule more added
26
+
27
+ - bug fix
28
+ - dependency packages version up
29
+ - `mocha@9.1.3`
30
+ - `typescript@4.3.5`
31
+
32
+ # 1.1.10
33
+
34
+ - bug fix
35
+ - `numberTester()` covers `NaN`
36
+
37
+ - dependency packages version up
38
+ - `mocha@8.2.1`
39
+ - `typescript@4.1.3`
40
+
41
+ # 1.1.9
42
+
43
+ - improvement
44
+ - testers return type optimized
45
+ - `length` rule added
46
+ - bug fix
47
+ - `tester.iso8601DateTester()` - `YYYYDDDD` format modified for leap year
48
+ - `dateTester()` became stricter
49
+ - `arrayTester()` use native function
50
+
51
+ # 1.1.8
52
+
53
+ - improvement
54
+ - `CHANGELOG.md` file added
55
+ - TypeScript `strict` flag set
56
+
57
+ - dependency packages version up
58
+ - `mocha@8.0.1`
59
+ - `typescript@3.9.5`
60
+
61
+ # 1.1.7
62
+
63
+ - improvement
64
+ - array error message format
65
+
66
+ - bug fix
67
+ - array temp key error fixed
68
+
69
+ - dependency packages version up
70
+ - `mocha@7.1.0`
71
+ - `typeScript@3.8.3`
72
+
73
+ # 1.1.6
74
+
75
+ - improvement
76
+ - `data` represent entire data passed to `ejv()`
77
+ - `errorData` added to `EjvError`
78
+ - `Function` declaration removed
79
+
80
+ - bug fix
81
+ - timezone error fixed
82
+
83
+ # 1.1.5
84
+
85
+ - improvement
86
+ - `null`, `undefined` flow optimized
87
+
88
+ - bug fix
89
+ - `null` parsing error fixed
90
+
91
+ # 1.1.4
92
+
93
+ - improvement
94
+ - array item `nullable` logic added
95
+
96
+ # 1.1.3
97
+
98
+ - improvement
99
+ - array error path format
100
+
101
+ # 1.1.2
102
+
103
+ - bug fix
104
+ - ITEMS_SCHEMES bug fixed
105
+
106
+ # 1.1.1
107
+
108
+ - improvement
109
+ - `ErrorType.ITEMS_SCHEME` deprecated
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Janghyun Han
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Janghyun Han
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.