4 Forms

4 Forms

  • Getting Started
  • API
  • Github
  • Help

›API Reference

Introduction

  • Getting Started
  • Installation
  • Motivation
  • Examples

Guides

  • Intro
  • Field
  • Schema
  • Nested schema
  • Related Field

API Reference

  • API Reference
  • Field
  • Schema
  • When
  • Rules

    • Generic
    • String
    • Number
    • Boolean
    • Array
    • Object
    • Iterator

Boolean

Rules for boolean validation.

Methods

  • truthy([options])
  • falsy([options])

Reference

truthy([options])

checks if the value of the boolean field equals to true.

Optionally, you can provide a options object that can hold message and constraints.

Example

import { Field } from "v4f";

const field = Field()
    .boolean()
    .truthy();

field.validate(true); // true
field.validate(false); // false

falsy([options])

checks if the value of the boolean field equals to false.

Optionally, you can provide a options object that can hold message and constraints.

Example

import { Field } from "v4f";

const field = Field()
    .boolean()
    .falsy();

field.validate(false); // true
field.validate(true); // false
← NumberArray →
  • Methods
  • Reference
    • truthy([options])
    • falsy([options])
4 Forms
Docs
Getting StartedGuidesAPI Reference
Community
Stack OverflowProject ChatTwitter
More
GitHub
Copyright © 2019 Soufiane Nassih