isArrayOf
isArrayOf(itemPredicate)Arguments:
Possible errors:
If provided Validatable is not an array:
Validatable is not an array:{
type: "isArray",
path: [/* ... */]
}If provided Validatable is an array that contains some items not matching the itemPredicate:
Validatable is an array that contains some items not matching the itemPredicate:Examples:
const { asVerificable, isValid, isArrayOf, isString, getErrors } = require("verifica");Non-array values (like string in this example) are not a valid array, and will fail with an isArray error:
isArray error:Empty array satisfies any itemPredicate, since there are no array elements that doesn't match it:
itemPredicate, since there are no array elements that doesn't match it:If some items in the array doesn't match itemPredicate, isArrayOf fails returning errors for all not-matching items. Errors are as returned by itemPredicate, including item index in the array in the path property:
itemPredicate, isArrayOf fails returning errors for all not-matching items. Errors are as returned by itemPredicate, including item index in the array in the path property:Last updated