Skip to content
This repository was archived by the owner on Oct 20, 2021. It is now read-only.

cknow/awesome-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e63ea57 · Feb 27, 2018
Feb 1, 2018
Feb 1, 2018
Feb 1, 2018
Jan 24, 2018
Jul 5, 2017
Jul 5, 2017
Sep 21, 2017
Jan 23, 2018
Jul 5, 2017
Feb 1, 2018
Jan 23, 2018
Feb 27, 2018
Sep 21, 2017
Feb 27, 2018
Feb 27, 2018
Feb 27, 2018
Nov 1, 2017
Jul 5, 2017
Feb 27, 2018
Feb 27, 2018

Repository files navigation

Awesome Validator

Awesome validator for node or browser.

NPM Version Downloads MIT License

Build Status Build status Coverage Status

Code Climate Test Coverage Issue Count

Dependencies Status devDependencies Status peerDependencies Status

Semantic Release Commitizen friendly Average time to resolve an issue Percentage of issues still open Gitter

NPM

Server-side

Install the library with npm install --save awesome-validator

var validator = require('awesome-validator').validator;

validator.notEmpty().stringType().validate('foo'); //=> true

ES6

import validator from 'awesome-validator';

validator.notEmpty().stringType().validate('foo'); //=> true

Or, import only a subset of the library:

import StringType from 'awesome-validator/lib/rules/string-type';

new StringType().validate('foo'); //=> true

Typescript

import { validator } from 'awesome-validator';

validator.notEmpty().stringType().validate('foo'); //=> true

Or, import only a subset of the library:

import { StringType } from 'awesome-validator/lib/rules/string-type';

new StringType().validate('foo'); //=> true

Client-side usage

The library can be loaded either as a standalone script, or through an AMD-compatible loader

<script type="text/javascript" src="awesome-validator.min.js"></script>
<script type="text/javascript">
    validator.notEmpty().stringType().validate('foo'); //=> true
</script>

Validators