/joi-enums-extension

Joi extensions for enums mapping

Primary LanguageJavaScriptOtherNOASSERTION

joi-enums-extension

Joi extensions for enums mapping.

Build Status NSP Status Known Vulnerabilities

Lead Maintainer: Wes Tyler

Usage

The .map method can be chained onto the base Joi number schema:

const BaseJoi = require('joi');
const Enums = require('joi-enums-extension');
const Joi = BaseJoi.extend(Enums);

const schema = Joi.number().map({
    admin : 1,
    vendor: 2,
    client: 3
});

API

See the API Reference.