Validate each value of an array.
npm install validity-validate-each --save
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)
]
}
}
})