Skip to content

v1.1.0

Latest
Compare
Choose a tag to compare
@LoaderB0T LoaderB0T released this 07 Nov 14:08
· 179 commits to main since this release

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.

Example:
image