hash
Creates a hash validation action.
const Action = v.hash<TInput, TMessage>(message);
Generics
TInputextends stringTMessageextends ErrorMessage<HashIssue<TInput>> | undefined
Parameters
types[HashType, ...HashType[]]messageTMessage
Explanation
With hash you can validate the formatting of a string. If the input is not a hash, you can use message to customize the error message.
Returns
ActionHashAction<TInput, TMessage>
Examples
The following examples show how hash can be used.
Hash schema
Schema to validate a hash.
const HashSchema = v.pipe(
v.string(),
v.hash(['md5', 'sha1'], 'The specified hash is invalid.')
);
Related
The following APIs can be combined with hash.
Schemas
Methods
Utils
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/hash/