# n3h-joi-validator

> validate message data using joi

Latest version **1.1.0** (published 2018-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install n3h-joi-validator
pnpm add n3h-joi-validator
yarn add n3h-joi-validator
bun add n3h-joi-validator
```

## 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 | 2018-03-27 |
| First published | 2018-03-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | zhaoyao91 |
| Maintainers | zhaoyao91 |
| Keywords | n3h, joi, validator |

## Links

- npm: https://www.npmjs.com/package/n3h-joi-validator
- Repository: https://github.com/zhaoyao91/n3h
- Homepage: https://github.com/zhaoyao91/n3h#readme
- Issues: https://github.com/zhaoyao91/n3h/issues
- npm.io page: https://npm.io/package/n3h-joi-validator

## Dependencies (1)

- [lodash.defaults](https://npm.io/package/lodash.defaults.md) ^4.2.0

## Alternatives

- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@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

## Recent versions

- 1.1.0 (latest) — 2018-03-27
- 1.0.0 — 2018-03-25

## README

# N3H Joi Validator

Validate N3H message data using [Joi](https://github.com/hapijs/joi).

## N3H Validator Schema

```
// if validation failed, throw an error
// if validation ok, the result is the original data or mapped data (generally, just resolve it to proper type)
(data) => data
```

## Installation

```
npm install joi
npm install n3h-joi-validator
```

## Usage

```
const Joi = require('joi')
const buildValidator = require('n3h-joi-validator')

const validator = buildValidator({
  name: Joi.string(),
  age: Joi.number().required(),
})
```

## API

```
(schema, Options?) => Validator

Options ~ {
  allowUnknown = true,
  presense = 'required'
} & see https://github.com/hapijs/joi/blob/v13.1.2/API.md#validatevalue-schema-options-callback

Validator ~ (data) => data
```

## License

MIT

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