bguard 0.0.6 → 0.0.8
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 +12 -12
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,7 +2,7 @@
|
|
|
2
2
|
"name": "bguard",
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.8",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.mjs",
|
|
8
8
|
"types": "lib/index.d.ts",
|
|
@@ -98,32 +98,32 @@
|
|
|
98
98
|
"types": "./lib/index.d.ts"
|
|
99
99
|
},
|
|
100
100
|
"./string/*": {
|
|
101
|
-
"import": "./lib/asserts/string/*.
|
|
101
|
+
"import": "./lib/asserts/string/*.mjs",
|
|
102
102
|
"require": "./lib/asserts/string/*.js",
|
|
103
|
-
"types": "./lib/asserts/
|
|
103
|
+
"types": "./lib/asserts/string/*.d.ts"
|
|
104
104
|
},
|
|
105
105
|
"./boolean/*": {
|
|
106
|
-
"import": "./lib/asserts/boolean/*.
|
|
106
|
+
"import": "./lib/asserts/boolean/*.mjs",
|
|
107
107
|
"require": "./lib/asserts/boolean/*.js",
|
|
108
|
-
"types": "./lib/
|
|
108
|
+
"types": "./lib/asserts/boolean/*.d.ts"
|
|
109
109
|
},
|
|
110
110
|
"./number/*": {
|
|
111
|
-
"import": "./lib/asserts/number/*.
|
|
111
|
+
"import": "./lib/asserts/number/*.mjs",
|
|
112
112
|
"require": "./lib/asserts/number/*.js",
|
|
113
|
-
"types": "./lib/asserts/
|
|
113
|
+
"types": "./lib/asserts/number/*.d.ts"
|
|
114
114
|
},
|
|
115
115
|
"./array/*": {
|
|
116
|
-
"import": "./lib/asserts/array/*.
|
|
116
|
+
"import": "./lib/asserts/array/*.mjs",
|
|
117
117
|
"require": "./lib/asserts/array/*.js",
|
|
118
|
-
"types": "./lib/asserts/
|
|
118
|
+
"types": "./lib/asserts/array/*.d.ts"
|
|
119
119
|
},
|
|
120
120
|
"./object/*": {
|
|
121
|
-
"import": "./lib/asserts/object/*.
|
|
121
|
+
"import": "./lib/asserts/object/*.mjs",
|
|
122
122
|
"require": "./lib/asserts/object/*.js",
|
|
123
|
-
"types": "./lib/asserts/
|
|
123
|
+
"types": "./lib/asserts/object/*.d.ts"
|
|
124
124
|
},
|
|
125
125
|
"./common/*": {
|
|
126
|
-
"import": "./lib/asserts/common/*.
|
|
126
|
+
"import": "./lib/asserts/common/*.mjs",
|
|
127
127
|
"require": "./lib/asserts/common/*.js",
|
|
128
128
|
"types": "./lib/asserts/common/*.d.ts"
|
|
129
129
|
}
|