@clocklimited/validity-compose

1.0.3 • Public • Published

validity-compose

Compose a number of validators together and call as a single validator. This is useful when used with a conditional validator.

This used to be called validity-validation-group

Installation

npm install --save @clocklimited/validity-compose

Usage

Below is a simple example for usage with schemata and save:

var validity = require('@clocklimited/validity')
  , schemata = require('schemata')
  , compose = require('@clocklimited/validity-compose')

var schema = schemata(
    { type:
      { type: String
      }
    , url:
      { type: String
      , validators: { all: [ validateIfPropertyIn('type', ['a', 'b'], compose([ validity.required, validity.url ]) ] }
      }
    })

Readme

Keywords

none

Package Sidebar

Install

npm i @clocklimited/validity-compose

Weekly Downloads

220

Version

1.0.3

License

ISC

Unpacked Size

8.94 kB

Total Files

6

Last publish

Collaborators

  • mrstebo
  • scott-clock
  • clock-release-bot
  • steepnicki
  • asheboy