isArray
isArray
Verifies 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); // false
String value is not considered as an array as well:
const verificable = asVerificable("something");
isValid(verificable, isArray); // false
Empty array is considered a valid array.
const verificable = asVerificable([]);
isValid(verificable, isArray); // true
Array of any items is a valid array:
const verificable = asVerificable(["one", "two", null]);
isValid(verificable, isArray); // true
Last updated
Was this helpful?