isString
isString
Verifies 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); // false
Non-string values are not matching the predicate:
const verificable = asVerificable(123);
isValid(verificable, isString); // false
String value is matching the predicate:
const verificable = asVerificable("abc");
isValid(verificable, isString); // true
Last updated
Was this helpful?