# validatit

> A package that makes json validation easier

Latest version **1.0.17** (published 2021-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install validatit
pnpm add validatit
yarn add validatit
bun add validatit
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.17 |
| Published | 2021-07-05 |
| First published | 2021-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Bahram Ghahari |
| Maintainers | xbg13 |
| Keywords | json, validation, verification, regex |

## Links

- npm: https://www.npmjs.com/package/validatit
- Repository: https://github.com/bahram-ghahari/validatit
- Homepage: https://github.com/bahram-ghahari/validatit#readme
- Issues: https://github.com/bahram-ghahari/validatit/issues
- npm.io page: https://npm.io/package/validatit

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.17 (latest) — 2021-07-05
- 1.0.16 — 2021-07-05
- 1.0.15 — 2021-06-30
- 1.0.14 — 2021-06-30
- 1.0.13 — 2021-06-30
- 1.0.12 — 2021-06-30
- 1.0.11 — 2021-06-30
- 1.0.10 — 2021-06-29
- 1.0.9 — 2021-06-29
- 1.0.8 — 2021-06-28
- 1.0.7 — 2021-06-09
- 1.0.6 — 2021-06-09
- 1.0.5 — 2021-06-09
- 1.0.4 — 2021-06-09
- 1.0.3 — 2021-06-09
- … 3 more at https://npm.io/package/validatit/versions

## README

<h1 align="center">Welcome to validatit 👋</h1>
<p>
  <a href="https://www.npmjs.com/package/validatit" target="_blank">
    <img alt="Version" src="https://img.shields.io/npm/v/validatit.svg">
  </a>
  <a href="https://github.com/bahram-ghahari/validatit#readme" target="_blank">
    <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
  </a>
  <a href="https://github.com/bahram-ghahari/validatit/graphs/commit-activity" target="_blank">
    <img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" />
  </a>
  <a href="https://github.com/bahram-ghahari/validatit/blob/master/LICENSE" target="_blank">
    <img alt="License: MIT" src="https://img.shields.io/github/license/bahram-ghahari/validatit" />
  </a>
</p>

> Validatit helps you to validate JSON objects.

### 🏠 [Homepage](https://github.com/bahram-ghahari/validatit#readme)

## Install

```sh
npm i validatit@latest
```


## Usage

```node
import {validatit} from 'validatit'
```

Call validatit function

```node
let json = {
    first_name:"jamie",
    phone:"+18889203388",
    address:{
        street:""
    }
};
let params=[
    {name:"*first_name:STRING"},
    {name:"*phone:PHONE"} ,
    {
    name:"address",
    params:[
      {name:"*street"}
    ]
    }

];
let res = await validatit(json,params);

```


## Params

Parameter name | description | example | notes
--- | --- | ---  | ---
name | name of the parameter to ve validated | name:"first_name"  | 
required | indicates that the parameter is mandatory | {name:"first_name" ,required:true} | you can use {name:"*first_name"} instead to have smaller validators
type | parameter type. Current types are :ARRAY, OBJECT, BOOLEAN, STRING, NUMBER, FUNCTION, DATE, CREDIT_CARD, EMAIL, PHONE, ANY | {name:"first_name" ,type:"STRING"} | you can use {name:"first_name:STRING"} instead to have smaller validators
 pattern | custom regular expression | {name:"first_name",pattern:/^[A-Z][a-z]+(?:[A-Z][a-z]+)*$/}  | 
 dynamicValidation | used for custom runtime validations | {name:"first_name",dynamicValidation:asyc(body)=>return {success:true,error_message:""}}  |  
 



## Run tests

```sh
npm run test
```

## Author

👤 **Bahram Ghahari**

* Github: [@bahram-ghahari](https://github.com/bahram-ghahari)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/bahram-ghahari/validatit/issues). You can also take a look at the [contributing guide](https://github.com/bahram-ghahari/validatit/blob/master/CONTRIBUTING.md).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright &copy; 2021 [Bahram Ghahari](https://github.com/bahram-ghahari).<br />
This project is [MIT](https://github.com/bahram-ghahari/validatit/blob/master/LICENSE) licensed.

***
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

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