Spec-Zone.ru › Valibot

finite

Creates a finite validation action.

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

Generics

  • TInput extends number
  • TMessage extends ErrorMessage<FiniteIssue<TInput>> | unknown

Parameters

  • message TMessage

Explanation

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

Returns

  • Action FiniteAction<TInput, TMessage>

Examples

The following examples show how finite can be used.

Finite number schema

Schema to validate a finite number.

const FiniteNumberSchema = v.pipe(
  v.number(),
  v.finite('The number must be finite.')
);

Related

The following APIs can be combined with finite.

Schemas

any, custom, number, unknown

Methods

pipe

Utils

isOfKind, isOfType

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

Spec-Zone.ru

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