nons
v0.3.0
Published
like zod, but simpler, lightweight scheme validation
Downloads
1
Readme
Installation
npm i nons
Usage
const validate = require("nons");
const types = require("nons/types");
const scheme = {
this: {
can: {
as: {
nested: {
as: types.string,
},
you: types.array,
},
like: types.number,
},
with: {
"optional?": types.string,
},
},
};
validate(schema, {
this: {
can: {
as: {
nested: {
as: "works!",
},
you: ["also", "works!"],
},
like: 1,
},
with: {}, // only child is optional, but parent is required
},
});