v0.5.0
Spected handles any array input now. (See #85)
The input can be
{ values: ['a', 'b'] }
or
{ values: [{a: 1}, {a: 2}] }
or
{ values: [1, 'a', {a: 1}] }
.
Spected runs any array input against a given spec. This also means that the defined predicates have to know how to handle the given input.
const userSpec = [
[
items => all(isLengthGreaterThan(5), items),
'Every item must have have at least 6 characters!'
]
]
const validationRules = {
id: [[ notEmpty, notEmptyMsg('id') ]],
users: userSpec,
}
const input = {
id: 4,
users: ['foobar', 'foobarbaz']
}
spected(validationRules, input)