Validators

Prompt-Set. Validators

Source:

Built-in validators for Promptlets
Can be added manually by importing this file or automatically through certain functions in Promptlets

Methods

(static) containsString(str, caseSensitiveopt)

Source:

Generates a validator that resolves to true only if a specific substring is found in the input

Parameters:
Name Type Attributes Default Description
str string

String that must be in the prompt answer

caseSensitive boolean <optional>
true

Whether the string search should be case-sensitive

(static) disableBlank(val) → {string|boolean}

Source:

Validator that disables blank inputs

Parameters:
Name Type Description
val string

Prompt answer to validate

Returns:

Returns true if valid and a string as an error message otherwise

Type
string | boolean

(static) integerOnly(val) → {string|boolean}

Source:

Validator that disables non-integer inputs

Parameters:
Name Type Description
val string

Prompt answer to validate

Returns:

Returns true if valid and a string as an error message otherwise

Type
string | boolean

(static) numberOnly(val) → {string|boolean}

Source:

Validator that disables non-number inputs

Parameters:
Name Type Description
val string

Prompt answer to validate

Returns:

Returns true if valid and a string as an error message otherwise

Type
string | boolean