valgen 4.3.0 → 4.3.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.
- package/CHANGELOG.md +7 -0
- package/cjs/rules/is-object.js +6 -4
- package/esm/rules/is-object.js +6 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/cjs/rules/is-object.js
CHANGED
|
@@ -32,10 +32,10 @@ function isObject(schema, options) {
|
|
|
32
32
|
throw new TypeError(`Invalid definition in validation schema (${k})`);
|
|
33
33
|
});
|
|
34
34
|
const _rule = (0, index_js_1.validator)('isObject', function (input, context, _this) {
|
|
35
|
+
if (ctor && ctor[isObject.preValidation])
|
|
36
|
+
input = ctor[isObject.preValidation](input, context);
|
|
35
37
|
if (typeof input === 'string' && context.coerce)
|
|
36
38
|
input = JSON.parse(input);
|
|
37
|
-
if (input && typeof input === 'object' && ctor && ctor.prototype[isObject.preValidation])
|
|
38
|
-
input = ctor.prototype[isObject.preValidation](input, context);
|
|
39
39
|
if (!(input && typeof input === 'object')) {
|
|
40
40
|
context.fail(_this, `{{label}} must be an object`, input);
|
|
41
41
|
return;
|
|
@@ -91,8 +91,10 @@ function isObject(schema, options) {
|
|
|
91
91
|
}
|
|
92
92
|
if (context.errors.length)
|
|
93
93
|
return undefined;
|
|
94
|
-
if (ctor && ctor
|
|
95
|
-
|
|
94
|
+
if (ctor && ctor[isObject.postValidation]) {
|
|
95
|
+
ctor[isObject.postValidation](out, context);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
96
98
|
return out;
|
|
97
99
|
}, options);
|
|
98
100
|
_rule.schema = schema;
|
package/esm/rules/is-object.js
CHANGED
|
@@ -29,10 +29,10 @@ export function isObject(schema, options) {
|
|
|
29
29
|
throw new TypeError(`Invalid definition in validation schema (${k})`);
|
|
30
30
|
});
|
|
31
31
|
const _rule = validator('isObject', function (input, context, _this) {
|
|
32
|
+
if (ctor && ctor[isObject.preValidation])
|
|
33
|
+
input = ctor[isObject.preValidation](input, context);
|
|
32
34
|
if (typeof input === 'string' && context.coerce)
|
|
33
35
|
input = JSON.parse(input);
|
|
34
|
-
if (input && typeof input === 'object' && ctor && ctor.prototype[isObject.preValidation])
|
|
35
|
-
input = ctor.prototype[isObject.preValidation](input, context);
|
|
36
36
|
if (!(input && typeof input === 'object')) {
|
|
37
37
|
context.fail(_this, `{{label}} must be an object`, input);
|
|
38
38
|
return;
|
|
@@ -88,8 +88,10 @@ export function isObject(schema, options) {
|
|
|
88
88
|
}
|
|
89
89
|
if (context.errors.length)
|
|
90
90
|
return undefined;
|
|
91
|
-
if (ctor && ctor
|
|
92
|
-
|
|
91
|
+
if (ctor && ctor[isObject.postValidation]) {
|
|
92
|
+
ctor[isObject.postValidation](out, context);
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
93
95
|
return out;
|
|
94
96
|
}, options);
|
|
95
97
|
_rule.schema = schema;
|
package/package.json
CHANGED