isArray
isArrayVerifies if provided Verificable represents an array.
Possible errors:
If provided Verificable is not an array:
Verificable is not an array:{
type: "isArray",
path: [/* ... */]
}Examples:
Each of examples uses this import statement:
const { asVerificable, isValid, isArray } = require("verifica");Null or undefined is not considered as an array:
const verificable = asVerificable(null);
isValid(verificable, isArray); // falseString value is not considered as an array as well:
const verificable = asVerificable("something");
isValid(verificable, isArray); // falseEmpty array is considered a valid array.
const verificable = asVerificable([]);
isValid(verificable, isArray); // trueArray of any items is a valid array:
const verificable = asVerificable(["one", "two", null]);
isValid(verificable, isArray); // trueLast updated
Was this helpful?