validity-validate-if-property-in

1.0.1 • Public • Published

validity-validate-if-property-in

Validate the current property if another property value is one of a list of values.

Installation

npm install validity-validate-if-property-in --save

Usage

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

var validity = require('validity')
  , schemata = require('schemata')
  , save = require('save')
  , collection = save('author')
  , validateIfPropertyIn = require('validity-validate-if-property-in')
 
var schema = schemata(
    { type:
      { type: String
      }
    , url:
      { type: String
      , validators: { all: [ validateIfPropertyIn('type', [ 'url', 'link' ], validity.url) ] }
      }
    })

Credits

This is a fork of validity-validate-if-property-equals by Adam Duncan

Readme

Keywords

none

Package Sidebar

Install

npm i validity-validate-if-property-in

Weekly Downloads

170

Version

1.0.1

License

ISC

Last publish

Collaborators

  • balaclark