fmvd
v1.1.3
Published
```javascript const fmvd = new Fmvd( { familyName: Fmvd.string().notEmpty("Family name shouldn't be empty"), firstName: Fmvd.string().notEmpty("First name shouldn't be empty"),
Downloads
2
Readme
Quick Start
const fmvd = new Fmvd(
{
familyName: Fmvd.string().notEmpty("Family name shouldn't be empty"),
firstName: Fmvd.string().notEmpty("First name shouldn't be empty"),
phone: Fmvd.string()
.notEmpty("Phone shouldn't be empty")
.external(async (value: any) => {
const isExists = await checkPhoneExists(value);
if (isExists) return "Phone exists";
}),
password: Fmvd.string()
.notEmpty("Password shouldn't be empty")
.password(
"strong",
`Password should contain three of the following four types:
1. Uppercase letters
2. Lowercase letters
3. Numbers
4. Symbols`
)
.minLength(8,"Password should be at least 8 characters long" ),
passwordConfirm: Fmvd.string()
.notEmpty("Confirmation password should't be empty")
.ref("password", "The password and confirmation password do not match"),
},
["phone", "birthday", "firstName", "familyName", "gender", "imgCode"]
);
const formData={
firstName: "",
phone: "",
familyName: "",
password:"",
passwordConfirm:""
}
const result= fmvd.validate(formData,(result)=>{
console.log(result)
})
console.log(result)