prompts-helpers
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Prompts Helpers

Collection of convenience helpers for Prompts.

Install

npm install --save prompts-helpers

Usage

The following methods are provided:

type confirm = ( message: string, initial: boolean = false ) => Promise<boolean>;
type noYes = ( message: string ) => Promise<boolean>;
type yesNo = ( message: string ) => Promise<boolean>;
type date = ( message: string, initial?: Date, validate?: (( value: Date ) => boolean | string) ) => Promise<Date | false>;
type number = ( message: string, max: number, min: number, validate?: (( value: number ) => boolean | string) ) => Promise<number | false>;
type password = ( message: string, validate?: (( value: string ) => boolean | string) ) => Promise<string | false>;
type text = ( message: string, validate?: (( value: string ) => boolean | string) ) => Promise<string | false>;
type select = <T extends string> ( message: string, choices: T[] ) => Promise<T | false>;
type multiselect = <T extends string> ( message: string, choices: T[], max: number = Infinity ) => Promise<T[] | false>;
type spinner = ( message: string ) => Spinner;

Check actual examples here.

License

MIT © Fabio Spampinato

Package Sidebar

Install

npm i prompts-helpers

Weekly Downloads

2

Version

2.0.1

License

none

Unpacked Size

14 kB

Total Files

12

Last publish

Collaborators

  • fabiospampinato