Simple form validation logic for JavaScript.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scripts Fix eot last Jan 15, 2017
src Change async validation execution order logic Jan 16, 2017
test Add async test support Jan 15, 2017
.babelrc Initial commit Jan 10, 2017
.eslintrc.js Initial commit Jan 10, 2017
.gitignore Initial commit Jan 10, 2017
.travis.yml Initial commit Jan 10, 2017
LICENSE Initial commit Jan 10, 2017
README.md Initial commit Jan 10, 2017
package.json Add async test support Jan 15, 2017
yarn.lock Add async test support Jan 15, 2017

README.md

drip-form-validator

Build Status npm version

⚡️ WIP PROJECT

Simple form validation logic for JavaScript.

Table of Contents

Install

$ npm install drip-form-validator

Usage

import Validator from "drip-form-validator";

const data = {
  firstName: null,
  lastName: "wada",
  phone: "hoge",
  age: "fuga",
  email: "mail-address",
  website: null,
  confirmed: true
};

const validator = new Validator(data, {
  firstName: ["required"],
  lastName: ["required"],
  phone: ["phone"],
  age: ["required", "numeric"],
  email: ["email"],
  website: ["url"],
  confirmed: ["truthy"]
});

if (validator.validate()) {
  console.error(validator.getErrors());
  // TODO

} else {
  // data is valid
}

API

Validation rules

// TODO

Contribute

PRs accepted.

License

MIT © tsuyoshiwada