bguard 0.0.7 → 0.0.9
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/README.md +5 -5
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -32,9 +32,9 @@ Let's define a schema for a Student object:
|
|
|
32
32
|
```typeScript
|
|
33
33
|
|
|
34
34
|
import { parseSchema, InferType, string, number, array, object, boolean } from 'bguard';
|
|
35
|
-
import { email } from 'bguard/
|
|
36
|
-
import { min } from 'bguard/
|
|
37
|
-
import { max } from 'bguard/
|
|
35
|
+
import { email } from 'bguard/string/email';
|
|
36
|
+
import { min } from 'bguard/number/min';
|
|
37
|
+
import { max } from 'bguard/number/max';
|
|
38
38
|
|
|
39
39
|
// Example: Student Schema
|
|
40
40
|
const studentSchema = object({
|
|
@@ -137,8 +137,8 @@ const schema = string().nullable().optional();
|
|
|
137
137
|
You can extend the validation with custom assertions:
|
|
138
138
|
|
|
139
139
|
```typeScript
|
|
140
|
-
import { min } from 'bguard/
|
|
141
|
-
import { max } from 'bguard/
|
|
140
|
+
import { min } from 'bguard/number/min';
|
|
141
|
+
import { max } from 'bguard/number/max';
|
|
142
142
|
|
|
143
143
|
const ageSchema = number().custom(min(18), max(120));
|
|
144
144
|
```
|
package/package.json
CHANGED
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
"name": "bguard",
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.9",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.mjs",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
|
-
"/lib"
|
|
11
|
-
"/lib/asserts/common",
|
|
12
|
-
"/lib/asserts/array",
|
|
13
|
-
"/lib/asserts/object",
|
|
14
|
-
"/lib/asserts/boolean",
|
|
15
|
-
"/lib/asserts/string",
|
|
16
|
-
"/lib/asserts/number"
|
|
10
|
+
"/lib"
|
|
17
11
|
],
|
|
18
12
|
"repository": {
|
|
19
13
|
"type": "git",
|
|
@@ -55,7 +49,8 @@
|
|
|
55
49
|
"release:package": "npm run build:package && changeset publish",
|
|
56
50
|
"change:start": "changeset",
|
|
57
51
|
"change:version": "changeset version",
|
|
58
|
-
"change:publish": "changeset publish"
|
|
52
|
+
"change:publish": "changeset publish",
|
|
53
|
+
"arethetypeswrong": "npx @arethetypeswrong/cli"
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@changesets/cli": "^2.27.7",
|
|
@@ -102,16 +97,16 @@
|
|
|
102
97
|
"require": "./lib/asserts/string/*.js",
|
|
103
98
|
"types": "./lib/asserts/string/*.d.ts"
|
|
104
99
|
},
|
|
105
|
-
"./boolean/*": {
|
|
106
|
-
"import": "./lib/asserts/boolean/*.mjs",
|
|
107
|
-
"require": "./lib/asserts/boolean/*.js",
|
|
108
|
-
"types": "./lib/asserts/boolean/*.d.ts"
|
|
109
|
-
},
|
|
110
100
|
"./number/*": {
|
|
111
101
|
"import": "./lib/asserts/number/*.mjs",
|
|
112
102
|
"require": "./lib/asserts/number/*.js",
|
|
113
103
|
"types": "./lib/asserts/number/*.d.ts"
|
|
114
104
|
},
|
|
105
|
+
"./boolean/*": {
|
|
106
|
+
"import": "./lib/asserts/boolean/*.mjs",
|
|
107
|
+
"require": "./lib/asserts/boolean/*.js",
|
|
108
|
+
"types": "./lib/asserts/boolean/*.d.ts"
|
|
109
|
+
},
|
|
115
110
|
"./array/*": {
|
|
116
111
|
"import": "./lib/asserts/array/*.mjs",
|
|
117
112
|
"require": "./lib/asserts/array/*.js",
|
|
@@ -126,6 +121,11 @@
|
|
|
126
121
|
"import": "./lib/asserts/common/*.mjs",
|
|
127
122
|
"require": "./lib/asserts/common/*.js",
|
|
128
123
|
"types": "./lib/asserts/common/*.d.ts"
|
|
124
|
+
},
|
|
125
|
+
"./*": {
|
|
126
|
+
"import": "./*.mjs",
|
|
127
|
+
"require": "./*.js",
|
|
128
|
+
"types": "./*.d.ts"
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|