1.0.1 • Published 9 years ago

validity-validate-if-property-in v1.0.1

Weekly downloads
58
License
ISC
Repository
github
Last release
9 years ago

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