https://github.com/anhthang/joi-array-extensions
Joi extensions for extra array rules.
https://github.com/anhthang/joi-array-extensions
continuous javascript joi-extensions schema validation
Last synced: about 1 year ago
JSON representation
Joi extensions for extra array rules.
- Host: GitHub
- URL: https://github.com/anhthang/joi-array-extensions
- Owner: anhthang
- License: mit
- Created: 2017-09-22T15:25:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-19T04:56:45.000Z (about 3 years ago)
- Last Synced: 2024-10-17T02:44:21.638Z (over 1 year ago)
- Topics: continuous, javascript, joi-extensions, schema, validation
- Language: HTML
- Size: 626 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# joi-array-extensions
Joi extensions for extra array rules.
[](https://npmjs.com/package/joi-array-extensions)    
# API
See the [API Reference](https://github.com/buianhthang/joi-array-extensions/blob/master/API.md).
# Usage
Usage is a two steps process. First, a schema is constructed using the provided types and constraints:
```js
const BaseJoi = require('@hapi/joi')
const Extension = require('joi-array-extensions')
const Joi = BaseJoi.extend(Extension)
const schema = Joi.array().items({
idx: Joi.number().integer()
}).continuous('idx', 1)
```
# Coverage
```
7 tests complete
Test duration: 51 ms
Assertions count: 40 (verbosity: 5.71)
Leaks: No issues
Coverage: 100.00%
Lint: No issues
```