/validity-validate-each

Validate each value of an array.

Primary LanguageJavaScriptMIT LicenseMIT

validity-validate-each

Validate each value of an array.

Installation

npm install validity-validate-each --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')
  , validateEach = require('validity-validate-each')

var schema = schemata(
    { emailAddresses:
      { type: Array
      , validators:
        { all:
          [ validateEach(validity.required)
          , validateEach(validity.email)
          ]
        }
      }
    })