Skip to content

daniel-samson/dilo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dilo

A validation library for deno. The name is short for "Dilophosaurus". It is essentially a port of laravel's validation library.

Project Status

This project is currently in active development. It follows the practices of Semantic Versioning.

Deno codecov JSR JSR Score

Usage

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" ]

Documentation

You can find the documentation for the latest version at read the docs.

Contributing

Setting up Git Hooks

After cloning the repository, run the following command to set up Git hooks:

./setup-hooks.sh