Alias for custom
Add a custom function to test the value with
import yxc from "@dotvirus/yxc"
yxc.string().test()
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
Alias for equals
Alias for 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
Allows null value
Allows undefined value
Alias for custom
Alias for custom
Alias for custom
Validate a value Returns a IValidationResult array
import yxc from "@dotvirus/yxc"
yxc.string().validate(myValue)
Generated using TypeDoc
Base handler for atomic values