checkmate

Build Status npm version

Checkmate is a very simple data validator.

Use cases

Characteristics

Example

See the react + is_js example.

import checkmate from 'checkmate'
import is from 'is_js'

const checkers = checkmate({
  email: {
    notEmpty: (str) => !is.empty(str),
    isEmail: is.email,
  },
  password: {
    truthy: (str) => !!str,
    minLength: (str) => str && str.length > 7,
  },
})

const errors = checkers({
  email: 'arnaud@efounderscom',
  password: false,
})

console.log(errors)

// → { email: ['isEmail'], password: ['truthy'] }