1.1.3 • Published 1 year ago

fmvd v1.1.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

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)
1.1.1

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago