safeInteger
Creates a safe integer validation action.
const Action = v.safeInteger<TInput, TMessage>(message);
Generics
TInputextends numberTMessageextends ErrorMessage<SafeIntegerIssue<TInput>> | undefined
Parameters
messageTMessage
Explanation
With safeInteger you can validate the value of a number. If the input is not a safe integer, you can use message to customize the error message.
Returns
ActionSafeIntegerAction<TInput, TMessage>
Examples
The following examples show how safeInteger can be used.
Safe integer schema
Schema to validate an safe integer.
const SafeIntegerSchema = v.pipe(
v.number(),
v.safeInteger('The number must be a safe integer.')
);
Related
The following APIs can be combined with safeInteger.
Schemas
Methods
Utils
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/safeInteger/