TextPrompt
validator
function config option replaced by validators
array:
const c = AwesomeLogger.prompt('text', {
text: 'Please enter your phone number:',
validators: [
{
description: 'The minimal input length is 8',
validator: (input: string) => {
return input.length >= 8;
}
},
{
description: 'Your input has to start with "+"',
validator: (input: string) => {
return input.startsWith('+');
}
}
]
});
Validator descriptions will be rendered to users if they try to confirm the prompt with an invalid input.