Perfect Schema
Model and schema validation done perfectly.
Install
npm i -S perfect-schema
Requirements
This modules does not provide a polyfill for a global Promise
impelementation if none is available. If such is the case, an ECMA-262 complient implementation should be defined before declaring any schema.
A client version of this module can be built using Gulp (i.e. $ gulp
) which can then be found in the dist
folder. If installed through npm, this file should already be provided as dist/perfect-schema.min.js
. The client module is wrapped by a UMD, and also globally exposes a PerfectSchema
constructor.
Usage
const PerfectSchema = ; const itemSchema = _id: String name: type: String required: true min: 3 qty: type: PerfectSchemaInteger defaultValue: 0 price: Number tags: String attributes: Object; const item = itemSchema; // all default values set const messages = await item; if !item console;
Documentation
Read the documentation for more information.
license
ISC