validno 0.3.1 → 0.3.2
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/dist/dev.js +9 -20
- package/dist/engine/methods/handleKey.js +1 -1
- package/package.json +2 -2
package/dist/dev.js
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import Schema from './index.js';
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
email: {
|
|
8
|
-
type: String,
|
|
9
|
-
required: true,
|
|
10
|
-
rules: {
|
|
11
|
-
isEmail: true
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
age: {
|
|
15
|
-
type: Number,
|
|
16
|
-
required: false
|
|
2
|
+
const schema = new Schema({
|
|
3
|
+
query: { type: Object },
|
|
4
|
+
data: { type: Object },
|
|
5
|
+
params: {
|
|
6
|
+
upsert: { type: Boolean, required: false },
|
|
17
7
|
}
|
|
18
8
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
const result = userSchema.validate(newUser, 'age');
|
|
9
|
+
console.log(schema.validate({
|
|
10
|
+
query: {},
|
|
11
|
+
data: {}
|
|
12
|
+
}));
|
|
@@ -5,7 +5,7 @@ function validateKeyValue(params) {
|
|
|
5
5
|
const missedCheck = [];
|
|
6
6
|
const typeChecked = [];
|
|
7
7
|
const rulesChecked = [];
|
|
8
|
-
if (hasMissing) {
|
|
8
|
+
if (hasMissing || !data) {
|
|
9
9
|
return this.handleMissingKeyValidation({ results, key, nestedKey, data, reqs, missedCheck });
|
|
10
10
|
}
|
|
11
11
|
this.validateType({ results, key, value: data[key], reqs, nestedKey, typeChecked });
|
package/package.json
CHANGED