Spec-Zone.ru › Valibot

toBoolean

Creates a to boolean transformation action.

const Action = v.toBoolean<TInput>();

Generics

  • TInput extends any

Returns

  • Action ToBooleanAction<TInput>

Examples

The following examples show how toBoolean can be used.

Boolean schema

Schema to validate a string and transform it to a boolean.

const BooleanSchema = v.pipe(v.string(), v.toBoolean());

Related

The following APIs can be combined with toBoolean.

Schemas

any, bigint, custom, date, null, number, string, symbol, undefined, unknown

Methods

pipe

Utils

isOfKind, isOfType

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

Spec-Zone.ru

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