isvalid 4.1.14 → 4.1.16
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/lib/formalize.js +6 -6
- package/lib/merge.js +1 -1
- package/lib/middleware.js +1 -1
- package/package.json +5 -5
package/lib/formalize.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// See license in LICENSE
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
-
import merge from 'merge';
|
|
9
|
+
import merge from '@trenskow/merge';
|
|
10
10
|
import SchemaError from './errors/schema.js';
|
|
11
11
|
import { instanceTypeName, typeName, isSameType } from './utils.js';
|
|
12
12
|
import { formalize as _formalizeRange, testFormalizedRange } from './ranges.js';
|
|
@@ -122,23 +122,23 @@ const formalizeAny = (schema, options = {}) => {
|
|
|
122
122
|
// Validators specific to type.
|
|
123
123
|
const type = Array.isArray(formalizedSchema.type) ? formalizedSchema.type[0] : formalizedSchema.type;
|
|
124
124
|
if (type !== undefined) {
|
|
125
|
-
if (isSameType('object', typeName(type))) merge(validators, {
|
|
125
|
+
if (isSameType('object', typeName(type))) validators = merge(validators, {
|
|
126
126
|
'schema': 'any',
|
|
127
127
|
'unknownKeys': [ 'string' ]
|
|
128
128
|
});
|
|
129
|
-
if (isSameType('array', typeName(type))) merge(validators, {
|
|
129
|
+
if (isSameType('array', typeName(type))) validators = merge(validators, {
|
|
130
130
|
'schema': 'any',
|
|
131
131
|
'len': [ 'string', 'number', testFormalizedRange ],
|
|
132
132
|
'unique': [ 'boolean' ],
|
|
133
133
|
'autoWrap': [ 'boolean' ]
|
|
134
134
|
});
|
|
135
|
-
if (isSameType('string', typeName(type))) merge(validators, {
|
|
135
|
+
if (isSameType('string', typeName(type))) validators = merge(validators, {
|
|
136
136
|
'len': [ 'string', 'number' ],
|
|
137
137
|
'match': [ 'regexp' ],
|
|
138
138
|
'trim': [ 'boolean' ],
|
|
139
139
|
'enum': [ 'array', 'object' ]
|
|
140
140
|
});
|
|
141
|
-
if (isSameType('number', typeName(type))) merge(validators, {
|
|
141
|
+
if (isSameType('number', typeName(type))) validators = merge(validators, {
|
|
142
142
|
'range': [ 'string', 'number', testFormalizedRange ],
|
|
143
143
|
'float': [ 'string' ]
|
|
144
144
|
});
|
|
@@ -146,7 +146,7 @@ const formalizeAny = (schema, options = {}) => {
|
|
|
146
146
|
|
|
147
147
|
// If post validator is provided allow for options.
|
|
148
148
|
if (formalizedSchema.pre !== undefined || formalizedSchema.post !== undefined) {
|
|
149
|
-
merge(validators, { 'options': 'any' });
|
|
149
|
+
validators = merge(validators, { 'options': 'any' });
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// Copy validators to formalizedSchema - checking
|
package/lib/merge.js
CHANGED
package/lib/middleware.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isvalid",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.16",
|
|
4
4
|
"description": "Async JSON validation library for node.js.",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,13 +15,10 @@
|
|
|
15
15
|
"express",
|
|
16
16
|
"connect"
|
|
17
17
|
],
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"merge": "^2.1.1"
|
|
20
|
-
},
|
|
21
18
|
"devDependencies": {
|
|
22
19
|
"@eslint/eslintrc": "^3.1.0",
|
|
23
20
|
"@eslint/js": "^9.13.0",
|
|
24
|
-
"@trenskow/caseit": "^1.4.
|
|
21
|
+
"@trenskow/caseit": "^1.4.4",
|
|
25
22
|
"body-parser": "^1.20.2",
|
|
26
23
|
"chai": "^5.1.1",
|
|
27
24
|
"chai-as-promised": "^8.0.0",
|
|
@@ -43,5 +40,8 @@
|
|
|
43
40
|
"name": "Kristian Trenskow",
|
|
44
41
|
"email": "trenskow@me.com",
|
|
45
42
|
"url": "https://github.com/trenskow"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@trenskow/merge": "^0.1.26"
|
|
46
46
|
}
|
|
47
47
|
}
|