validation-form-library

1.0.3 • Public • Published

Validation Library

This is a simple validation library for form inputs. It includes functions to validate emails, passwords, and phone numbers.

Installation

npm install validation-form-library

## Usage 

const validation = require('validation-form-library');

// Validate email
const email = 'test@example.com';
const emailResult = validation.isValidEmail(email);

if(!emailResult.valid) {
  console.log(emailResult.message); 
}

// Validate password
const password = 'Password123';
const passwordResult = validation.isValidPassword(password);

if(!passwordResult.valid) {
  console.log(passwordResult.message);
}

// Validate phone number 
const phoneNumber = '+628123456789';
const phoneValid = validation.isValidPhoneNumber(phoneNumber);

if(!phoneValid) {
  console.log('Invalid phone number'); 
}

Functions
isValidEmail(email)

Validates email address format. Returns an object with valid and message properties.

isValidPassword(password)

Validates password complexity. Returns an object with valid and message properties.

isValidPhoneNumber(phoneNumber)

Validates phone number format. Returns a boolean.

License
This project is licensed under the MIT License.

Contact
If you have any questions or issues, please open a GitHub issue or submit a pull request

Package Sidebar

Install

npm i validation-form-library

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

3.3 kB

Total Files

4

Last publish

Collaborators

  • ryuen