# @viewitjs/validate

> ViewitJS framework Validate Module

Latest version **0.3.2** (published 2019-07-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @viewitjs/validate
pnpm add @viewitjs/validate
yarn add @viewitjs/validate
bun add @viewitjs/validate
```

## 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.3.2 |
| Published | 2019-07-21 |
| First published | 2019-06-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 8.16.0 |
| Dependencies | 1 |
| Unpacked size | 18.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Diego Londoño |
| Maintainers | dl-viewit |
| Keywords | viewit, viewitjs, validate, npm, package |

## Links

- npm: https://www.npmjs.com/package/@viewitjs/validate
- Repository: https://github.com/viewitjs/validate
- Homepage: https://github.com/viewitjs/validate#readme
- Issues: https://github.com/viewitjs/validate/issues
- npm.io page: https://npm.io/package/@viewitjs/validate

## Dependencies (1)

- [nyc](https://npm.io/package/nyc.md) ^14.1.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.3.2 (latest) — 2019-07-21
- 0.3.1 — 2019-07-21
- 0.3.0 — 2019-07-21
- 0.2.3 — 2019-07-20
- 0.2.2 — 2019-07-20
- 0.2.1 — 2019-07-20
- 0.2.0 — 2019-07-20
- 0.1.0 — 2019-06-05

## README

[![Build Status](https://travis-ci.com/viewitjs/validate.svg?branch=master)](https://travis-ci.com/viewitjs/validate) [![Test Coverage](https://api.codeclimate.com/v1/badges/7fa50404f47c3502f5aa/test_coverage)](https://codeclimate.com/github/viewitjs/validate/test_coverage) [![Maintainability](https://api.codeclimate.com/v1/badges/7fa50404f47c3502f5aa/maintainability)](https://codeclimate.com/github/viewitjs/validate/maintainability)

# ViewitJS Validate

Viewit JS Validate Module

## Getting Started

Please install the package

```javascript
npm i @viewitjs/validate
```

### How to use it

```javascript
const Validator = require('@viewitjs/validate')
const validate = new Validator()
```

### Methods

#### typeOf

Set the type and value

```javascript
validate.typeOf('string', 'text')
validate.typeOf('number', 2)

const text;
validate.typeOf('undefined', text)

validate.typeOf('null', null)

validate.typeOf('array', [])
validate.typeOf('object', {})
validate.typeOf('function', () => {})
validate.typeOf('symbol', Symbol())
```

This method return true if the type match with the value

#### isEmpty

Set value

```javascript
const value = ''
validate.isEmpty(value)
```

This method return true if the value is empty

#### bySchema

Set the schema and data

```javascript
const schema = {
	id: 'number',
	body: {
		content: 'string'
	}
}

const data = {
	id: 2,
	body: {
		content: 'Hello World!'
	}
}

validate.bySchema(schema, data)
```

This method return true if the data againts the schema

* If some property not found or not match with type provided return false

#### getErrors

Get the array of validation errors

```javascript
validate.getErrors()
```

### Prerequisites

Before installing, download and install [Node.js](https://nodejs.org)

V8 or higher is required.

## Development

If you want to parcipate please visit [viewitjs](https://github.com/viewitjs)

Navigate to a project folder where you want to work and fork the repository

```
git fork git@github.com:viewitjs/validate.git {package name}
```

Install all dev dependencies

```
npm install -D
```

Create new branch and start work & enjoy it

## Contributing

Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.

## Versioning

We are in firsts stages of the development. If you want to contribute with this project please visit:

[ViewitJS](https://github.com/viewitjs)

## Authors

- **Diego Londoño** - **Viewit Team**
- **Elias Valdez** - **Viewit Team**

## License

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

## Acknowledgments

- To all interested contributors

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