1.0.6 • Published 4 years ago

laiello-simple-validator v1.0.6

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

laiello-simple-validator

A set of utility functions to test if the given string is in a valid US phone number format or email format.

Installation

npm i laiello-simple-validator

Example

// Import the functions 
import { isEmail, isPhoneNumber } from 'laiello-simple-validator'

// Usage 
const emailResult = isEmail('test@email.com') // returns true or flase
const phoneResult = isPhoneNumber('test@email.com') // return true or false

Functions

isEmail

Given a string, returns true if string is in email format using RegExp | Parameter | Description | |-----------|--------------------| | string | Email user entered |

isPhoneNumber

Given a string, returns true if string is in email format using RegExp. This will consiste of 10 digit phone numbers. Does not include the country code of '1'. Vaild formats are as follows: 1234567890, 123-456-7890, 123.456.7890, (123) 456-7890, 123 456 7890, (123)456-7890 | Parameter | Description | |-----------|--------------------------| | string | Phone numer user entered |

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago