At first, thanks for your good job with this library I really like it.
I would like to be able to validate property which has array of strings for example.
const input = {
users: [
'foobar',
'longerstring'
]
}
const validationRules = {
users: [[
array => array.every(item => item.length > 6),
'Every item in array must be string with at least 5 characters'
]],
}
const validationResult = spected(validationRules, input)
And it would return this:
{ users: true }
or this:
{ users: [ 'Every item in array must be string with at least 5 characters' ] }
depending on validation predicate and input data.
Currently, it retuns error:
TypeError: Invalid attempt to destructure non-iterable instance
I have tried to avoid validation of such property by omitting it from validation rules (that would be also nice to be able to do that, such as with other properties according to docs), but it also returns error:
At first, thanks for your good job with this library I really like it.
I would like to be able to validate property which has array of strings for example.
And it would return this:
or this:
depending on validation predicate and input data.
Currently, it retuns error:
I have tried to avoid validation of such property by omitting it from validation rules (that would be also nice to be able to do that, such as with other properties according to docs), but it also returns error: