@jrc03c/prompt

0.0.5 • Public • Published

Intro

This is a little package that makes it easy to prompt for user input in a Node program. There are better tools out there, but I just wanted something simple and easy.

Installation

npm install --save @jrc03c/prompt

Usage

The prompt function can be used in Promise mode or callback mode:

const prompt = require("@jrc03c/prompt")

// Promise mode
prompt("Hey! What's your name?").then(name => {
  console.log(`Nice to meet you, ${name}!`)
})

// Callback mode
prompt("Hey! What's your name?", name => {
  console.log(`Nice to meet you, ${name}!`)
})

You can also pass an optional boolean parameter to indicate that the text should be hidden with asterisks, like when typing a password.

const isHidden = true

prompt("Password:", isHidden).then(password => {
  console.log("Your password is:", password)
})

Readme

Keywords

Package Sidebar

Install

npm i @jrc03c/prompt

Weekly Downloads

1

Version

0.0.5

License

ISC

Unpacked Size

2.03 kB

Total Files

3

Last publish

Collaborators

  • jrc03c