deepvalid
v1.1.9
Published
Deep input validation for node.js api
Downloads
13
Maintainers
Readme
Description
deep-validation helps you build API input params validation
Installation
npm i deepvalid
Documentation
https://webigorkiev.github.io/deepvalid/
Features
- Zero Dependencies
- Supports deep input object
- Very simple small library
- Focus on usability and performance
- Testing coverage
Run tests with Mocha
$ npm run test
Usage
import {validator, ValidationError, required} from "deepvalid";
try {
const request = {test: "test value"};
const valid = validator();
valid.setModel({"test": {required}});
valid.validate(request);
return true;
} catch(err) {
const e: ValidationError = err;
console.log(e.getMessage())
}