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 CHANGED
@@ -1,23 +1,12 @@
1
1
  import Schema from './index.js';
2
- const userSchema = new Schema({
3
- name: {
4
- type: String,
5
- required: true
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
- const newUser = {
20
- name: "Barney",
21
- email: "barney@himym.com",
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "validno",
3
- "version": "0.3.1",
4
- "description": "",
3
+ "version": "0.3.2",
4
+ "description": "A lightweight TypeScript validation library for runtime data validation.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "tsc": "tsc -b src/",