1.5.1 • Published 4 years ago

@bauke2112/invalidjs v1.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Invalid-JS

Invalid-JS 2.x.x is being developed! Check the branch invalid@next

Ivalid-JS is a Typescript-first schema validation library.

It is inspired by other validation libraries like Yup and Joi. Ivalid-JS tries to solve some problems regarding code duplication in such libraries, while exposing a simple and familiar function chaining API.

With Invalid-JS, it is also possible to create custom schemas and custom validation logic really easily.

Installation

To install Invalid-JS you can use one of the following commands, depending on the package manager you are using:

npm i @bauke2112/invalidjs --save
yarn add @bauke2112/invalidjs

Usage

Invalid-JS defines some function for creating schemas:

import { string, number, boolean, object } from '@bauke2112/invalidjs';

// Defining the schema
const schema = object().shape({
	name: string().required(),
	age: number().required(),
	isBrazilian: boolean().required(),
});

// Validating the schema
const [isValid, errors] = await schema.validate({
	name: 'Gustavo',
	age: 17,
	isBrazilian: true,
});

API

1.5.1

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago