Awesome
fossil
A typescript validation suite for deno projects.
At this alpha stage fossil support validation for the following types:
- String
- Number
- Symbol
- Custom function
- Array
- Object
- Null
- Undefined
- Alphanumeric
A good companion project for fossil
is Microraptor a lightweight framework for easy routing.
Install
Import fossil in your project with just one line of code:
import { Validator } from "https://deno.land/x/fossil/fossil.ts";
How to use
Check type
let testBoolean = new Validator(true, ValidatorType.boolean);
console.log(testBoolean.isValid()); // true
testBoolean = new Validator("home", ValidatorType.boolean);
console.log(testBoolean.isValid()); // Invalid type
For more use feel free to check test examples.
Check type and value
let testBoolean = new Validator(true, ValidatorType.boolean, [true]);
console.log(testBoolean.isValid()); // true
Extra
Credits Icon made by Freepik from www.flaticon.com