0.2.1 • Published 7 years ago

json-type-check v0.2.1

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

json-type-check

A typechecker for JSON

import Jst from 'json-type-check'

const value = {
 requiredString: 'foo'
}

const schema = Jst.shape({
  requiredString: [
    Jst.string,
    Jst.required
  ],
  optionalInteger: Jst.integer,
  optionalDate: Jst.date,
  optionalEnum: Jst.oneOf([
    Jst.integer,
    Jst.string
  ])
})

const check = new Jst(value, schema)

console.log(check.valid) // true

console.log(check.errors) // []
0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago