# @validate.it/rules

> ## Installation

Latest version **0.0.0** (published 2018-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @validate.it/rules
pnpm add @validate.it/rules
yarn add @validate.it/rules
bun add @validate.it/rules
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2018-09-28 |
| First published | 2018-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 86.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Olavo Amorim Santos |
| Maintainers | olavo.a.santos |

## Links

- npm: https://www.npmjs.com/package/@validate.it/rules
- Homepage: https://github.com/olavoasantos/validate.it
- npm.io page: https://npm.io/package/@validate.it/rules

## Recent versions

- 0.0.0 (latest) — 2018-09-28

## README

# @validate.it/rules

## Installation

```bash
// If you are using npm
npm install --save @validate.it/rules

// If you are using yarn
yarn add @validate.it/rules
```

## Rule structure

Validation rules are JS objects containing a `message` and a `check` functions.

```ts
{
  message: Function (attribute: string, options: Object),
  check: Function (options: Object, ...args: any)
}
```

### `message`

The message function defines the error message. It should return a `String` and it receives the following parameters:

- `attribute <String>`: The name of the validated field
- `options <Object>`: A object containing the rules options

### `check`

This functions will validate the value. It should return a `Boolean` (`true` if passes, `false` if fails) and receives the following parameters:

- `options <Object>`: Object containing the valaidation data:

  - `attribute <String>`: name of the field being validated
  - `value <Any>`: value of the field being validated
  - `data <Object>`: object containing all the fields being validated

- `...args <Any>`: the rest of the arguments are the validation rules options passed in order

## Available rules

- [accepted](/rules/rules/accepted/)
- [after](/rules/rules/after/)
- [afterOrEqual](/rules/rules/afterOrEqual/)
- [alpha](/rules/rules/alpha/)
- [alphaDash](/rules/rules/alphaDash/)
- [alphaNum](/rules/rules/alphaNum/)
- [array](/rules/rules/array/)
- [before](/rules/rules/before/)
- [beforeOrEqual](/rules/rules/beforeOrEqual/)
- [between](/rules/rules/between/)
- [boolean](/rules/rules/boolean/)
- [confirmed](/rules/rules/confirmed/)
- [date](/rules/rules/date/)
- [dateEquals](/rules/rules/dateEquals/)
- [dateFormat](/rules/rules/dateFormat/)
- [different](/rules/rules/different/)
- [digits](/rules/rules/digits/)
- [digitsBetween](/rules/rules/digitsBetween/)
- [distinct](/rules/rules/distinct/)
- [email](/rules/rules/email/)
- [greaterThan](/rules/rules/greaterThan/)
- [greaterThanOrEqual](/rules/rules/greaterThanOrEqual/)
- [image](/rules/rules/image/)
- [in](/rules/rules/in/)
- [inArray](/rules/rules/inArray/)
- [integer](/rules/rules/integer/)
- [ip](/rules/rules/ip/)
- [ipv4](/rules/rules/ipv4/)
- [ipv6](/rules/rules/ipv6/)
- [json](/rules/rules/json/)
- [lessThan](/rules/rules/lessThan/)
- [lessThanOrEqual](/rules/rules/lessThanOrEqual/)
- [max](/rules/rules/max/)
- [mimetypes](/rules/rules/mimetypes/)
- [mimes](/rules/rules/mimes/)
- [min](/rules/rules/min/)
- [notIn](/rules/rules/notIn/)
- [notRegex](/rules/rules/notRegex/)
- [nullable](/rules/rules/nullable/)
- [numeric](/rules/rules/numeric/)
- [present](/rules/rules/present/)
- [regex](/rules/rules/regex/)
- [required](/rules/rules/required/)
- [requiredIf](/rules/rules/requiredIf/)
- [requiredUnless](/rules/rules/requiredUnless/)
- [requiredWith](/rules/rules/requiredWith/)
- [requiredWithAll](/rules/rules/requiredWithAll/)
- [requiredWithout](/rules/rules/requiredWithout/)
- [requiredWithoutAll](/rules/rules/requiredWithoutAll/)
- [same](/rules/rules/same/)
- [size](/rules/rules/size/)
- [string](/rules/rules/string/)
- [url](/rules/rules/url/)

## Version log

- **v0.0.x**:

  - Initial commits
  - Created first rules

## Author

- [Olavo Amorim Santos](https://github.com/olavoasantos/)

---
_Source: https://npm.io/package/@validate.it/rules · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
