Options
All
  • Public
  • Public/Protected
  • All
Menu

Boolean handler

Hierarchy

Index

Constructors

constructor

Properties

Protected _rules

_rules: Rule<boolean>[] = ...

_type

_type: boolean

Methods

check

custom

enum

  • Only allows a selection of values

    import yxc from "@dotvirus/yxc"
    
    const allowedValues = ["test", "test2", "test3"]
    
    yxc.string().enum(allowedValues).validate("test") // -> OK
    yxc.string().enum(allowedValues).validate("asdasd") // -> Fails
    

    Parameters

    • values: boolean[]

    Returns BooleanHandler

eq

equal

equals

  • Only allows a certain value Value is checked using strict equality (===)

    import yxc from "@dotvirus/yxc"
    
    yxc.string().equals("test").validate("test") // -> OK
    yxc.string().equals("test").validate("test2") // -> Fails
    

    Parameters

    • expected: boolean

    Returns BooleanHandler

false

nullable

optional

rule

test

true

use

validate

Generated using TypeDoc