Spec-Zone.ru › Valibot

integer

Creates an integer validation action.

const Action = v.integer<TInput, TMessage>(message);

Generics

  • TInput extends number
  • TMessage extends ErrorMessage<IntegerIssue<TInput>> | undefined

Parameters

  • message TMessage

Explanation

With integer you can validate the value of a number. If the input is not an integer, you can use message to customize the error message.

Returns

  • Action IntegerAction<TInput, TMessage>

Examples

The following examples show how integer can be used.

Integer schema

Schema to validate an integer.

const IntegerSchema = v.pipe(
  v.number(),
  v.integer('The number must be an integer.')
);

Related

The following APIs can be combined with integer.

Schemas

any, custom, number, unknown

Methods

pipe

Utils

isOfKind, isOfType

© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/integer/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API