0.1.1 • Published 1 year ago
@netclues/react-native-netclues-validator v0.1.1
@netclues/react-native-netclues-validator
The Validator package offers a comprehensive suite of validation methods for common data types, including email, phone number, strong password, credit card number, and CVV. It also includes functionality to determine credit card types based on card numbers. With predefined regular expressions and flexible customization options, this package ensures robust and accurate validation for various use cases.
Installation
Using npm:
npm install @netclues/react-native-netclues-validatoror using yarn:
yarn add @netclues/react-native-netclues-validatorUsage
Importing the Validator
import { Validator } from 'react-native-netclues-validator';Check if a value is empty
const isEmpty = Validator.isEmpty(''); // trueValidate an email address
const isValidEmail = Validator.emailValidate('example@example.com'); // trueValidate a phone number
const isValidPhone = Validator.phoneNumberValidate('+1234567890'); // trueValidate a strong password
const isValidPassword = Validator.strongPasswordValidate('Password123!'); // trueValidate a credit card number
const isValidCardNumber = Validator.creditCardNumberValidate('4111 1111 1111 1111'); // trueValidate a CVV code
const isValidCVV = Validator.cvvValidate('123', 'Visa'); // trueGet the type of a credit card
const cardType = Validator.getcardType('4111 1111 1111 1111'); // 'Visa'License
MIT