@namopanda/form-validation
v1.0.1
Published
A form-validator utility for validating various input fields.
Downloads
1
Maintainers
Readme
Form Validator
Form Validator is a lightweight npm package that provides various form validation functions to simplify form validation in JavaScript applications.
Installation
You can install the package via npm:
npm install @namopanda/form-validator
// Import the desired form validation functions from the package and use them in your JavaScript code.
const {
validateEmail,
validatePhoneNumber,
validateAddress,
validateName,
validatePassword,
} = require('form-validator');
// Example usage
const email = '[email protected]';
if (validateEmail(email)) {
console.log('Email is valid.');
} else {
console.log('Email is invalid.');
}
const phoneNumber = '1234567890';
if (validatePhoneNumber(phoneNumber)) {
console.log('Phone number is valid.');
} else {
console.log('Phone number is invalid.');
}
//Available Validation Functions
//The following form validation functions are available in this package:
validateEmail(email): Validates an email address.
validatePhoneNumber(phone): Validates a phone number.
validateAddress(address): Validates an address.
validateName(name): Validates a name.
validatePassword(password): Validates a password.
Please refer to the function descriptions in the source code for more details on their usage and return values.
License
This project is licensed under the MIT License. See the LICENSE file for details.