@dwp/govuk-casa
Version:
A framework for building GOVUK Collect-And-Submit-Applications
50 lines (49 loc) • 1.38 kB
TypeScript
/**
* @typedef {import("../../casa").ErrorMessageConfig} ErrorMessageConfig
* @access private
*/
/**
* @typedef {object} StrlenConfigOptions
* @property {ErrorMessageConfig} errorMsgMax Error message to use on max length
* failure
* @property {ErrorMessageConfig} errorMsgMin Error message to use on min length
* failure
* @property {number} max Maximum string length allowed
* @property {number} min Minimum string length required
*/
/**
* Test the length of a string.
*
* See {@link StrlenConfigOptions} for `make()` options.
*
* @memberof Validators
* @augments ValidatorFactory
*/
export default class Strlen extends ValidatorFactory {
name: string;
validate(inputValue?: string, dataContext?: {}): ValidationError[];
sanitise(value: any): string | undefined;
}
export type ErrorMessageConfig = import("../../casa").ErrorMessageConfig;
export type StrlenConfigOptions = {
/**
* Error message to use on max length
* failure
*/
errorMsgMax: ErrorMessageConfig;
/**
* Error message to use on min length
* failure
*/
errorMsgMin: ErrorMessageConfig;
/**
* Maximum string length allowed
*/
max: number;
/**
* Minimum string length required
*/
min: number;
};
import ValidatorFactory from "../ValidatorFactory.js";
import ValidationError from "../ValidationError.js";