validator.fn

3.0.4 • Public • Published

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

Package Sidebar

Install

npm i validator.fn

Weekly Downloads

1

Version

3.0.4

License

MIT

Unpacked Size

64.5 kB

Total Files

12

Last publish

Collaborators

  • sibiraj-s