Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kylelaverty/joi-array-extension
Joi Extension to allow turning incoming string fields into arrays
https://github.com/kylelaverty/joi-array-extension
Last synced: about 2 months ago
JSON representation
Joi Extension to allow turning incoming string fields into arrays
- Host: GitHub
- URL: https://github.com/kylelaverty/joi-array-extension
- Owner: kylelaverty
- License: other
- Created: 2018-05-14T13:43:49.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-30T15:59:45.000Z (over 6 years ago)
- Last Synced: 2024-09-03T07:24:52.555Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# joi-array-extension
Joi extensions for extra string rules.
[![npm version](https://badge.fury.io/js/joi-array-extension.svg)](http://badge.fury.io/js/joi-array-extension)
[![Build Status](https://secure.travis-ci.org/kylelaverty/joi-array-extension.svg?branch=master)](http://travis-ci.org/kylelaverty/joi-array-extension)Lead Maintainer: [Kyle Laverty](https://github.com/kylelaverty)
# Overview
This extention is focused on adding the ability to split strings into arrays so that they can be used with the rest of the joi ecosystem as if they were arrays.
# Usage
Usage is a two steps process. First, a schema is constructed using the provided types and constraints:
```js
const BaseJoi = require('joi');
const Extension = require('joi-array-extension');
const Joi = BaseJoi.extend(Extension);const schema = Joi.array().separator(',').items(...);
```# API
See the [API Reference](https://github.com/kylelaverty/joi-array-extension/blob/master/API.md).