# node-veee

> javascript object validation

Latest version **1.1.0** (published 2016-04-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-veee
pnpm add node-veee
yarn add node-veee
bun add node-veee
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-04-27 |
| First published | 2015-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vladimir Popov |
| Maintainers | rusintez |

## Links

- npm: https://www.npmjs.com/package/node-veee
- npm.io page: https://npm.io/package/node-veee

## Dependencies (2)

- [seed-queue](https://npm.io/package/seed-queue.md) ^2.0.0
- [seed-extend](https://npm.io/package/seed-extend.md) ^1.0.0

## Recent versions

- 1.1.0 (latest) — 2016-04-27
- 1.0.1 — 2015-09-15
- 1.0.0 — 2015-09-15

## README

# veee

Object schema validation inspired by `joi` (almost the same, but async and extensible)

### Installation

    $ npm install node-veee --save

### Usage
    
```js

var V = require('node-veee');

var v = new V([options]);

v.use(function(v) {
  v.register('number', function(value, context, cb) {
    if (typeof value === 'number' && value === value) return cb();
    cb('is not a number');
  });
  
  v.register('number', 'integer', function(value, context, cb) {
    if (parseInt(value.toString(), 10) === value) return cb();
    cb('is not an integer');
  });
  
  v.register('number', 'positive', function(value, context, cb) {
    if (value > 0) return cb();
    cb('is not a positive number');
  });
})

v.validate(5, v.number().positive().integer(), function(err, result) {
  // null, 5
});

v.validate(-1, v.number().positive(), function(err, result) {
  // { type: 'number', name: 'positive', path: '_', value: -1, error: 'is not a positive number' }, undefined
});

var date = new Date();

v.validate(date, v.or(v.date(), v.string().isodate()), ...);
```

### Build-in types

`veee` is trying to be very similar to `joi`. it contains a few build-in validators:

- number
- string
- boolean
- array
- object
- date
- function
- any (inherited by all types)

### TODO

- update documentation

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