1.7.18 • Published 2 years ago
persianyup v1.7.18
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
2 years ago
1.7.15
3 years ago
1.7.16
3 years ago
1.7.17
3 years ago
1.7.14
3 years ago
1.7.13
3 years ago
1.7.12
3 years ago
1.7.11
3 years ago
1.7.10
3 years ago
1.7.9
3 years ago
1.7.8
3 years ago
1.7.7
3 years ago
1.7.6
3 years ago
1.7.3
3 years ago
1.7.2
3 years ago
1.7.5
3 years ago
1.7.4
3 years ago
1.7.1
3 years ago
1.6.1
3 years ago
1.5.14
3 years ago
1.5.13
3 years ago
1.5.12
3 years ago
1.5.10
3 years ago
1.5.11
3 years ago
1.4.10
3 years ago
1.4.9
3 years ago
1.4.8
3 years ago
1.4.7
3 years ago
1.4.6
3 years ago
1.3.6
3 years ago
1.3.5
3 years ago
1.3.4
3 years ago
1.3.3
3 years ago
1.2.3
3 years ago
1.1.3
3 years ago
1.1.2
3 years ago
1.1.1
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago