# validation-x

> [![npm package][npm-badge]][npm] ![npm-bundle-size] ![Module formats][module-formats] ![npm-download-count]

Latest version **0.0.2** (published 2021-01-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install validation-x
pnpm add validation-x
yarn add validation-x
bun add validation-x
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2021-01-19 |
| First published | 2021-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kaan Seyitogullari |
| Maintainers | kaansey |
| Keywords | validation, validator, chain-validator, simple-validator, validate-input |

## Links

- npm: https://www.npmjs.com/package/validation-x
- Repository: https://github.com/kaansey/validation-x
- Issues: https://github.com/kaansey/validation-x/issues
- npm.io page: https://npm.io/package/validation-x

## Alternatives

- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads
- [@oridune/validator](https://npm.io/package/@oridune/validator.md) — 16 weekly downloads

## Recent versions

- 0.0.2 (latest) — 2021-01-19
- 0.0.1 — 2021-01-19

## README

# validation-x

[![npm package][npm-badge]][npm] ![npm-bundle-size] ![Module formats][module-formats] ![npm-download-count]

Simple chain validator for string, number, date input

## String Validation

### Options

| Name      | Type                                   | Description                                                                     |
| --------- | -------------------------------------- | ------------------------------------------------------------------------------- |
| string    | func(errorMessage:string)              | Type check                                                                      |
| required  | func(errorMessage:string)              | isEmpty check                                                                   |
| len       | func(val: number, errorMessage:string) | Exact length check for input                                                    |
| min       | func(val: number, errorMessage:string) | Min length for input                                                            |
| max       | func(val: number, errorMessage:string) | Max length for input                                                            |
| matches   | func(val: number, errorMessage:string) | regex check                                                                     |
| email     | func(errorMessage:string)              | Email check with (/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\$/)         |
| url       | func(errorMessage:string)              | URL check with (/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+ | (?:www. | [-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]_)?\??(?:[-\+=&;%@.\w_]\_)#?(?:[\w]\*))?)/) |
| lowercase | func(errorMessage:string)              | lowercase check                                                                 |
| uppercase | func(errorMessage:string)              | uppercase check                                                                 |
| custom    | func(func, errorMessage:string)        | check with provided custom function                                             |

## Number Validation

### Options

| Name     | Type                                   | Description                         |
| -------- | -------------------------------------- | ----------------------------------- |
| number   | func(errorMessage:string)              | Type check                          |
| min      | func(val: number, errorMessage:string) | Min for input                       |
| max      | func(val: number, errorMessage:string) | Max for input                       |
| positive | func(errorMessage:string)              | If input is positive number         |
| negative | func(errorMessage:string)              | If input is negative number         |
| matches  | func(val: number, errorMessage:string) | regex check                         |
| custom   | func(func, errorMessage:string)        | check with provided custom function |

## Date Validation

### Options

| Name | Type                                 | Description   |
| ---- | ------------------------------------ | ------------- |
| min  | func(val: Date, errorMessage:string) | Min for input |
| max  | func(val: Date, errorMessage:string) | Max for input |

### License

This project is licensed under the MIT License - see the
[LICENCE.md](./LICENCE.md) file for details


[npm-download-count]: https://img.shields.io/npm/dm/validation-x
[npm-bundle-size]: https://img.shields.io/bundlephobia/min/validation-x
[npm-badge]: https://img.shields.io/npm/v/validation-x?style=flat-square
[npm]: https://www.npmjs.com/package/validation-x
[module-formats]: https://img.shields.io/badge/module%20formats-cjs%2C%20esm-green.svg?style=flat-square

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