@dwp/govuk-casa
Version:
A framework for building GOVUK Collect-And-Submit-Applications
51 lines (50 loc) • 1.43 kB
TypeScript
/**
* @typedef {import("../../casa").ErrorMessageConfig} ErrorMessageConfig
* @access private
*/
/**
* @typedef {object} WordcountConfigOptions
* @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 number of words in a string.
*
* See {@link WordcountConfigOptions} for `make()` options.
*
* @memberof Validators
* @augments ValidatorFactory
*/
export default class WordCount extends ValidatorFactory {
name: string;
count(input: any): any;
validate(inputValue?: string, dataContext?: {}): ValidationError[];
sanitise(value: any): string | undefined;
}
export type ErrorMessageConfig = import("../../casa").ErrorMessageConfig;
export type WordcountConfigOptions = {
/**
* 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";