Neologistic Paraphasic Mumbling
    Have ideas to improve npm?Join in the discussion! »

    promise-prompt

    1.1.1 • Public • Published

    Prompt for standard input

    Examples

    Basic usage (promise):

    const prompt = require('promise-prompt');
     
    prompt('What is your favorite color? ').then(answer => {
      if (answer === 'all of them') console.log('Me too!');
      else console.log('Nice I like that one too!');
    });

    Async/Await:

    const prompt = require('promise-prompt');
     
    (async () => {
      const name = await prompt('What is your name? ');
     
      if (name === 'Adam') console.log('Me too!');
      else console.log('What a beautiful name!');
    })();

    Callback:

    const prompt = require('promise-prompt');
     
    prompt('What is your favorite color? ', function (answer) {
      if (answer === 'all of them') console.log('Me too!');
      else console.log('Good one!');
    });

    Install

    npm i promise-prompt

    DownloadsWeekly Downloads

    626

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    3.38 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar