We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cebacd0 commit 0f7b872Copy full SHA for 0f7b872
README.md
@@ -0,0 +1,24 @@
1
+# Validate
2
+
3
+```js
4
+const { validate, email, length } = require('validate')
5
6
+const rules = {
7
+ fields: {
8
+ email: {
9
+ validator: () => {
10
+ return email(value) && length(value, { max: 75 })
11
+ },
12
13
+ password: {
14
15
+ return length(value, { min: 18, max: 45 })
16
17
+ }
18
19
+}
20
21
+const { valid } = validate(fields, {
22
+ rules,
23
+})
24
+```
REAMD.md
src/validate.js
@@ -1,6 +1,6 @@
function validate (fields, { rules }) {
if (isEmpty(fields)) {
- return false
+ return { valid: false, results: [] }
}
const checked = []
0 commit comments