schema2
v0.1.1
Published
The idea is simple structure and evaluates the objects in Javascript.
Downloads
1
Readme
Schema2
<(。_。)>
Sorry, this is just beginning.
tl;dr
The idea is simple structure and evaluates the objects in Javascript.
Example
import Schema2 from 'schema2'
schema = Schema2.parse({
title: String,
body: {
code: Number,
message: String,
}
})
io.on('message', (data, next) => {
// data: Object {title: "Hola", villain: { face: ":(" }}
let validated = schema.validate(data)
/*
Object {title: "Hola"}
*/
next(validated)
})