@caricati/nvalid
v1.0.2
Published
<img src="./.github/logo.svg" alt="Caricati.io - Design System" width="406"> <p> <a href="https://www.npmjs.com/package/@caricati/nvalid"> <img src="https://img.shields.io/badge/package-npm-FA9703" alt="npm"> </a> <img src="https://github.com/ca
Downloads
2
Readme
nvalid
A lightweight validation library written in JavaScript.
Install
Install nvalid dependency using node package manager:
npm i @caricati/nvalid
Using
Use only a fragment from the library:
import { isEmail } from '@caricati/nvalid'
isEmail('invalid email@here') // false
isEmail('[email protected]') // true
Use a collection of validations:
import validate from '@caricati/nvalid'
validate('[email protected]').email().required() // passed
validate('Mr. Caricati').string().required() // passed
validate('my ip').ip() // handle exception
validate('').required() // handle exception