validflow 1.0.0 → 1.0.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/README.md +91 -0
- package/package.json +5 -2
- package/readme.md +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# validflow - Minimal Validation Library in JavaScript
|
|
2
|
+
|
|
3
|
+
A lightweight validation library inspired by Zod for JavaScript.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i validflow
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
const z = require("mini-zod");
|
|
15
|
+
|
|
16
|
+
// String validation
|
|
17
|
+
const username = z.string().min(3).max(10);
|
|
18
|
+
|
|
19
|
+
console.log(username.parse("Rohan"));
|
|
20
|
+
|
|
21
|
+
// Number validation
|
|
22
|
+
const age = z.number().min(18).max(60);
|
|
23
|
+
|
|
24
|
+
console.log(age.parse(25));
|
|
25
|
+
|
|
26
|
+
// Boolean validation
|
|
27
|
+
const isAdmin = z.boolean();
|
|
28
|
+
|
|
29
|
+
console.log(isAdmin.parse(true));
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- String validation
|
|
37
|
+
- Number validation
|
|
38
|
+
- Boolean validation
|
|
39
|
+
- Min & Max validation
|
|
40
|
+
- Method chaining
|
|
41
|
+
- Lightweight and beginner-friendly
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Example
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
z.string().min(3).max(10).parse("Rohan");
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
|
|
55
|
+
- This library is built for learning purposes.
|
|
56
|
+
- Inspired by Zod.
|
|
57
|
+
- Great for understanding schema validation internally.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Future Features
|
|
62
|
+
|
|
63
|
+
- object()
|
|
64
|
+
- array()
|
|
65
|
+
- optional()
|
|
66
|
+
- email()
|
|
67
|
+
- safeParse()
|
|
68
|
+
- TypeScript support
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Keywords
|
|
79
|
+
|
|
80
|
+
validation
|
|
81
|
+
schema
|
|
82
|
+
zod
|
|
83
|
+
mini-zod
|
|
84
|
+
javascript
|
|
85
|
+
validator
|
|
86
|
+
type-validation
|
|
87
|
+
schema-validation
|
|
88
|
+
lightweight
|
|
89
|
+
nodejs
|
|
90
|
+
custom-zod
|
|
91
|
+
input-validation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "validflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "myZod.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -9,5 +9,8 @@
|
|
|
9
9
|
"keywords": [],
|
|
10
10
|
"author": "Rohan Nandavdekar",
|
|
11
11
|
"license": "ISC",
|
|
12
|
-
"description": "Minimal validation library in Javascript"
|
|
12
|
+
"description": "Minimal validation library in Javascript",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"validflow": "^1.0.0"
|
|
15
|
+
}
|
|
13
16
|
}
|
package/readme.md
DELETED
|
File without changes
|