sibiraj-s / validator.fn

A simple function to aid form validations

Home Page:https://npm.im/validator.fn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

validator.fn Tests

A simple function to aid form validations

Getting Started

Installation

Install via Package managers such as npm or yarn

npm install validator.fn --save
# or
yarn add validator.fn

or use cdn

Minified:

//cdn.jsdelivr.net/npm/validator.fn@latest/validator.fn.umd.min.js

Pretty Printed:

//cdn.jsdelivr.net/npm/validator.fn@latest/validator.fn.umd.js

Usage

This library is compiled to UMD format, you should be able to use it in both Node.js and browser.

import validate from 'validator.fn';

const err = validate('hey', ['isString', 'minLength:3', 'hasLength:3']) // is valid

const err = validate(3, ['isNumber', 'inRange:1-10'])
console.log(err) // -> null

Supported Validations

  • isString
  • isNumber
  • iSEmail
  • isRequired
  • minLength
  • maxLength
  • hasLength
  • inRange
  • hasPattern

About

A simple function to aid form validations

https://npm.im/validator.fn

License:MIT License


Languages

Language:JavaScript 98.9%Language:Shell 1.1%