1.0.1 • Published 8 years ago

@partially-applied/inspector v1.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

npm.io

fast schema validator for nested json

npm install @partially-applied/inspector

Quick Guide

inspector = require('@partially-applied/inspector').default

lo = require('lodash')

S = lo.isString

schema =
 a:S
 b:
   c:S
   d:S

testInput1 = # Correct Input
 a:"hello"
 b:
   c:"foo"
   d:'world'


tester = inspector(schema)

console.log tester testInput1 # [true]

testInput2 = # Incorrect Input
 a:"hello"
 b:
  *c:"foo"
   d:1


console.log(tester(testInput2)) # [false,['b','d']]

Features

  • Performance
  • Small API surface
  • Error handling inspired from studying the writer monad.

Docs

  • I have written a short post that details the context under which @partially-applied/inspector is useful.

  • The API guide on the otherhand is for quick referencing purpose.