1.7.18 • Published 3 years ago

persianyup v1.7.18

Weekly downloads
274
License
ISC
Repository
github
Last release
3 years ago

what is this?

Persian Yup-Schema for Formik!

  • This is an useful object for persian form validation with yup and formik

Installation

npm i persianform yarn add persianform

Then..

import persianYup from 'persianyup'
import { Formik } from 'formik

const schema = persianYup([
        "isMobilePhone",
        "isHomePhone",
        "isPostalCode",
        "isOtp",
        "isGpa",
        "isNationalCode",
        "isAddress",
        "isGpaLetter",
        "isEducationFieldName",
        "isUniversityName",
        "isRadioButton",
        "isCheckBox",
        "isSheba",
        "isCardNumber",
        "isFullName",
        "isFirstName",
        "isLastName",
        "isUserName",
        "isPassword",
        "isFatherName",
        "isDate",
        "isSsn",
        "isCity",
        "isValidFile",
        "isVin",
        "isBarcode"

        <!-- Additional Items -->
        "isAddress1",
        "isAddress2",
        "isUniversityName1",
        "isUniversityName2",
        "isEducationFieldName1",
        "isEducationFieldName2",
        "isValidFile1",
        "isValidFile2",
    ])

<Formik validationSchema={schema}>
    ...
</Formik>

Source Code Example

isMobilePhone: Yup.string()
    .test(
      "isMobilePhone",
      messageValidate("matches", "شماره همراه"),
      (isMobilePhone) => persianform.isMobilePhone(isMobilePhone)
    )
    .min(11, messageValidate("exact", "11", "شماره همراه"))
    .max(11, messageValidate("exact", "11", "شماره همراه"))
    .required(messageValidate("required", "شماره همراه")),

Options

  • you can choose each validate you want

Dependencies

-yup -persianform

1.7.18

3 years ago

1.7.15

4 years ago

1.7.16

4 years ago

1.7.17

4 years ago

1.7.14

4 years ago

1.7.13

4 years ago

1.7.12

4 years ago

1.7.11

4 years ago

1.7.10

4 years ago

1.7.9

4 years ago

1.7.8

4 years ago

1.7.7

4 years ago

1.7.6

4 years ago

1.7.3

4 years ago

1.7.2

4 years ago

1.7.5

4 years ago

1.7.4

4 years ago

1.7.1

4 years ago

1.6.1

4 years ago

1.5.14

4 years ago

1.5.13

4 years ago

1.5.12

4 years ago

1.5.10

4 years ago

1.5.11

4 years ago

1.4.10

4 years ago

1.4.9

4 years ago

1.4.8

4 years ago

1.4.7

4 years ago

1.4.6

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.2.3

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago