Neurotic Programmer Masquerade

    json-type-check

    0.2.1 • Public • Published

    json-type-check

    A typechecker for JSON

    Build Status Code Climate Code Coverage
    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) // []

    Keywords

    none

    Install

    npm i json-type-check

    DownloadsWeekly Downloads

    10

    Version

    0.2.1

    License

    ISC

    Last publish

    Collaborators

    • ccetc
    • mahaplatform
    • mochini