@partially-applied/inspector

1.0.1 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @partially-applied/inspector

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • partially-applied