itee-validators 5.3.1 → 5.3.5
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 +28 -0
- package/README.md +4 -4
- package/builds/itee-validators.cjs.js +20 -18
- package/builds/itee-validators.cjs.js.map +1 -1
- package/builds/itee-validators.esm.js +9 -7
- package/builds/itee-validators.esm.js.map +1 -1
- package/builds/itee-validators.iife.js +10 -8
- package/builds/itee-validators.iife.js.map +1 -1
- package/package.json +19 -19
- package/sources/cores/cores.js +6 -6
- package/sources/cores/numbers/isSafeInteger.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itee-validators",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.5",
|
|
4
4
|
"description": "A library of validation functions use in various Itee projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"itee",
|
|
@@ -56,43 +56,43 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@semantic-release/
|
|
62
|
-
"@semantic-release/
|
|
63
|
-
"@semantic-release/
|
|
64
|
-
"@semantic-release/
|
|
59
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
60
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
61
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
62
|
+
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
63
|
+
"@semantic-release/git": "^10.0.1",
|
|
64
|
+
"@semantic-release/github": "^8.0.2",
|
|
65
|
+
"@semantic-release/npm": "^9.0.0",
|
|
66
|
+
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
65
67
|
"ansi-colors": "^4.1.1",
|
|
66
68
|
"benchmark": "^2.1.4",
|
|
67
|
-
"chai": "^4.3.
|
|
69
|
+
"chai": "^4.3.6",
|
|
68
70
|
"cz-conventional-changelog": "^3.3.0",
|
|
69
71
|
"del": "^6.0.0",
|
|
70
|
-
"eslint-plugin-mocha": "^
|
|
71
|
-
"fancy-log": "^
|
|
72
|
+
"eslint-plugin-mocha": "^10.0.3",
|
|
73
|
+
"fancy-log": "^2.0.0",
|
|
72
74
|
"gulp": "^4.0.2",
|
|
73
75
|
"gulp-eslint": "^6.0.0",
|
|
74
76
|
"gulp-jsdoc3": "^3.0.0",
|
|
75
77
|
"gulp-replace": "^1.1.3",
|
|
76
|
-
"karma": "^6.3.
|
|
78
|
+
"karma": "^6.3.16",
|
|
77
79
|
"karma-benchmark": "^1.0.4",
|
|
78
80
|
"karma-benchmarkjs-reporter": "^1.0.0",
|
|
79
81
|
"karma-chai": "^0.1.0",
|
|
80
82
|
"karma-chrome-launcher": "^3.1.0",
|
|
81
83
|
"karma-edge-launcher": "^0.4.2",
|
|
82
|
-
"karma-firefox-launcher": "^2.1.
|
|
84
|
+
"karma-firefox-launcher": "^2.1.2",
|
|
83
85
|
"karma-htmlfile-reporter": "^0.3.8",
|
|
84
86
|
"karma-mocha": "^2.0.1",
|
|
85
87
|
"karma-mocha-reporter": "^2.2.5",
|
|
86
|
-
"leveldown": "^6.
|
|
88
|
+
"leveldown": "^6.1.0",
|
|
87
89
|
"minimist": "^1.2.5",
|
|
88
|
-
"mocha": "^9.0
|
|
89
|
-
"mochawesome": "^
|
|
90
|
-
"rollup": "^2.
|
|
91
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
92
|
-
"rollup-plugin-node-resolve": "^5.2.0",
|
|
90
|
+
"mocha": "^9.2.0",
|
|
91
|
+
"mochawesome": "^7.0.1",
|
|
92
|
+
"rollup": "^2.67.2",
|
|
93
93
|
"rollup-plugin-re": "^1.0.7",
|
|
94
94
|
"rollup-plugin-terser": "^7.0.2",
|
|
95
|
-
"semantic-release": "^
|
|
95
|
+
"semantic-release": "^19.0.2"
|
|
96
96
|
},
|
|
97
97
|
"optionalDependencies": {},
|
|
98
98
|
"config": {
|
package/sources/cores/cores.js
CHANGED
|
@@ -189,7 +189,7 @@ class Validator {
|
|
|
189
189
|
|
|
190
190
|
if ( isNotString( type ) ) { throw new TypeError( `Validator: Expect type to be a string` ) }
|
|
191
191
|
if ( isNotFunction( validator ) && isNotObject( validator ) ) { throw new TypeError( `Validator: Expect validator to be an object or a function` ) }
|
|
192
|
-
if ( isDefined( this.validators[ type ] ) ) { throw new TypeError( `Validator: a validator is already defined for type '${type}'` ) }
|
|
192
|
+
if ( isDefined( this.validators[ type ] ) ) { throw new TypeError( `Validator: a validator is already defined for type '${ type }'` ) }
|
|
193
193
|
|
|
194
194
|
this.validators[ type ] = validator
|
|
195
195
|
|
|
@@ -235,7 +235,7 @@ class Validator {
|
|
|
235
235
|
|
|
236
236
|
const validator = this.validators[ type ]
|
|
237
237
|
if ( isNotDefined( validator ) ) {
|
|
238
|
-
throw new TypeError( `Validator: Unable to find schema validation of type '${type}'` )
|
|
238
|
+
throw new TypeError( `Validator: Unable to find schema validation of type '${ type }'` )
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
let result = true
|
|
@@ -250,7 +250,7 @@ class Validator {
|
|
|
250
250
|
|
|
251
251
|
const subValidator = validator[ key ]
|
|
252
252
|
if ( isNotDefined( subValidator ) ) {
|
|
253
|
-
throw new TypeError( `Validator: Missing validator for key '${key}' of type '${type}'` )
|
|
253
|
+
throw new TypeError( `Validator: Missing validator for key '${ key }' of type '${ type }'` )
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
const value = data[ key ]
|
|
@@ -268,7 +268,7 @@ class Validator {
|
|
|
268
268
|
if ( isDefined( validatorFunction ) ) {
|
|
269
269
|
|
|
270
270
|
if ( isNotFunction( validatorFunction ) ) {
|
|
271
|
-
throw new TypeError( `Validator: Invalid validation function for '${key}' with type '${type}'` )
|
|
271
|
+
throw new TypeError( `Validator: Invalid validation function for '${ key }' with type '${ type }'` )
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
subResult = validatorFunction( value )
|
|
@@ -281,7 +281,7 @@ class Validator {
|
|
|
281
281
|
|
|
282
282
|
if ( subResult === false ) {
|
|
283
283
|
|
|
284
|
-
this.errors.push( `Validator: Invalid property '${key}' of type '${subValidator.type}' with value '${value}' in object of type '${type}'` )
|
|
284
|
+
this.errors.push( `Validator: Invalid property '${ key }' of type '${ subValidator.type }' with value '${ value }' in object of type '${ type }'` )
|
|
285
285
|
result = false
|
|
286
286
|
if ( breakOnError ) {
|
|
287
287
|
break
|
|
@@ -293,7 +293,7 @@ class Validator {
|
|
|
293
293
|
|
|
294
294
|
} else {
|
|
295
295
|
|
|
296
|
-
throw new TypeError( `Validator: Unknown validator of type '${type}'` )
|
|
296
|
+
throw new TypeError( `Validator: Unknown validator of type '${ type }'` )
|
|
297
297
|
|
|
298
298
|
}
|
|
299
299
|
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
export function isMaxSafeInteger ( data ) {
|
|
26
26
|
return ( data === Number.MAX_SAFE_INTEGER )
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
// Todo: Neg
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -36,4 +37,5 @@ export function isMaxSafeInteger ( data ) {
|
|
|
36
37
|
export function isMinSafeInteger ( data ) {
|
|
37
38
|
return ( data === Number.MIN_SAFE_INTEGER )
|
|
38
39
|
}
|
|
40
|
+
|
|
39
41
|
// Todo: Neg
|