0.4.0 • Published 7 years ago

checkmate v0.4.0

Weekly downloads
187
License
MIT
Repository
github
Last release
7 years ago

checkmate

Build Status npm version

Checkmate is a very simple data validator.

Use cases

  • form input validation
  • model validation

Characteristics

  • no dependency
  • framework / lib / context agnostic: describe what you expect → send an object → get errors
  • does not come with validation functions, write your own or combine with libraries such as is.js

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'] }
0.4.0

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.0

7 years ago

0.0.1

9 years ago