Type Alias BooleanValidator

BooleanValidator: Validator<boolean, string[]> & {
    eq: (value: boolean) => BooleanValidator;
}

A validator that can validate a boolean value.

Type declaration

  • eq: (value: boolean) => BooleanValidator

    Checks if the value is equal to the given value.

    const validator = avery.boolean().eq(true);
    const result = validator.validate(false);
    console.log(result.isOk()); // Output: false
const validator = avery.boolean();
const result = validator.validate(true);
console.log(result.isOk()); // Output: true