Type Alias ArrayValidator<T>

ArrayValidator: Validator<T[], string[]> & {
    maxLength: (n: number) => ArrayValidator<T>;
}

A validator that can validate an array based on the validator given.

Type Parameters

  • T

    The type of the array.

Type declaration

  • maxLength: (n: number) => ArrayValidator<T>

    Checks if the array's length is equal or lower than n.

const validator = avery.array(avery.string());
const result = validator.validate(['hello', 'world']);
console.log(result.isOk()); // Output: true