Hiyve Components - v1.0.0
    Preparing search index...
    validators: {
        custom: <T>(
            validatorFn: (value: T) => boolean,
            message: string,
        ) => Validator<T>;
        email: (message?: string) => Validator<string>;
        maxLength: (max: number, message?: string) => Validator<string>;
        minLength: (min: number, message?: string) => Validator<string>;
        noSpecialChars: (message?: string) => Validator<string>;
        pattern: (regex: RegExp, message: string) => Validator<string>;
        range: (min: number, max: number, message?: string) => Validator<number>;
        required: (message?: string) => Validator<string>;
        url: (message?: string) => Validator<string>;
    } = ...

    Common validator factory functions.

    Type Declaration

    • custom: <T>(validatorFn: (value: T) => boolean, message: string) => Validator<T>

      Custom validator that allows any validation logic.

    • email: (message?: string) => Validator<string>

      Validates that a value is a valid email address.

    • maxLength: (max: number, message?: string) => Validator<string>

      Validates maximum string length.

    • minLength: (min: number, message?: string) => Validator<string>

      Validates minimum string length.

    • noSpecialChars: (message?: string) => Validator<string>

      Validates that a string contains no special characters. Allows letters, numbers, spaces, hyphens, and underscores.

    • pattern: (regex: RegExp, message: string) => Validator<string>

      Validates that a string matches a regex pattern.

    • range: (min: number, max: number, message?: string) => Validator<number>

      Validates a numeric range.

    • required: (message?: string) => Validator<string>

      Validates that a string value is not empty.

    • url: (message?: string) => Validator<string>

      Validates that a value is a valid URL.

    const validators = [
    validators.required('This field is required'),
    validators.minLength(3, 'Must be at least 3 characters'),
    validators.maxLength(100, 'Must be 100 characters or less'),
    ];