isString
isStringVerifies if provided Verificable represents a value that is a string.
The check internally is done by checking the type of the value typeof value === "string".
Possible errors:
If provided Verificable is not a string:
Verificable is not a string:{
type: "isString",
path: [/* ... */]
}Examples:
Each of examples uses this import statement:
const { asVerificable, isValid, isString } = require("verifica");Null or undefined is not considered a string:
const verificable = asVerificable(null);
isValid(verificable, isString); // falseNon-string values are not matching the predicate:
const verificable = asVerificable(123);
isValid(verificable, isString); // falseString value is matching the predicate:
const verificable = asVerificable("abc");
isValid(verificable, isString); // trueLast updated
Was this helpful?