A validation library for deno. The name is short for "Dilophosaurus". It is essentially a port of laravel's validation library.
This project is currently in active development. It follows the practices of Semantic Versioning.
import { Dilo } from "@danielsamson/dilo";
const rules = {
foo: "required|numeric",
bar: "sometimes|string",
baz: "nullable|boolean",
};
const request = Dilo.make(rules);
const errors = request.validate({ foo: "1", bar: "bar", baz: true });
if (errors) {
for (const field of Object.keys(errors)) {
console.log(field, errors[field]);
}
}
Output:
foo [ "foo must be a numeric value" ]
You can find the documentation for the latest version at read the docs.
After cloning the repository, run the following command to set up Git hooks:
./setup-hooks.sh