@joi-extensions/joi-extensions

    1.1.0 • Public • Published

    Joi extensions

    Extensions for Joi validator.

    Build Status npm GitHub license GitHub issues

    Installation

     npm install @joi-extensions/joi-extensions

    Usage

    Usage is a two steps process. First, a schema is constructed using the provided types and constraints:

    const BaseJoi = require('joi')
    const {AnyExtensions} = require('@joi-extensions/joi-extensions')
    const Joi = BaseJoi.extend(AnyExtensions)
     
    const schema = Joi.any().sizeof(20)
    const BaseJoi = require('joi')
    const {StringExtensions} = require('@joi-extensions/joi-extensions')
    const Joi = BaseJoi.extend(StringExtensions)
     
    const schema = Joi.string().objectId()
    const BaseJoi = require('joi')
    const {ArrayExtensions} = require('@joi-extensions/joi-extensions')
    const Joi = BaseJoi.extend(ArrayExtensions)
     
    const schema = Joi.array().even()

    API

    See the detailed API Reference.

    Install

    npm i @joi-extensions/joi-extensions

    DownloadsWeekly Downloads

    46

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    24.6 kB

    Total Files

    17

    Last publish

    Collaborators

    • avatar