Options
All
  • Public
  • Public/Protected
  • All
Menu

Base handler for atomic values

Type parameters

  • T = string | number | boolean

Hierarchy

Index

Constructors

constructor

Properties

Protected _rules

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

_type

_type: T

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: T[]

    Returns AtomicHandler<T>

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: T

    Returns AtomicHandler<T>

nullable

optional

rule

test

use

validate

Generated using TypeDoc