@mendix/pluggable-widgets-tools
Version:
Mendix Pluggable Widgets Tools
21 lines (20 loc) • 1.19 kB
TypeScript
export declare class WidgetValidationError extends Error {
name: string;
constructor(message: string);
}
/**
* Asserts that the given input string only contains the characters specified by `legalCharacters`.
* @param input The string under test
* @param legalCharacters The characters that the input string may contain. Follows character class notation from regex (inside the [])
* @param message The message that is included in the error. Specify where the input is used and can be corrected.
* @throws WidgetValidationError If the input contains characters not allowed by legalCharacters
*/
export declare function throwOnIllegalChars(input: string, legalCharacters: string, message: string): void;
/**
* Asserts that the given input string matches the given pattern.
* @param input The string under test
* @param pattern The pattern the input must match
* @param message The message that is included in the error. Specify where the input is used and can be corrected.
* @throws WidgetValidationError If the input contains characters not allowed by legalCharacters
*/
export declare function throwOnNoMatch(input: string, pattern: RegExp, message: string): void;