jsprompt

1.0.1 • Public • Published

jsprompt

An NPM Package that makes creating prompts in NodeJS Easier again, using the 'readline' package.

Table of Contents

• prompt(str)

A function that returns a promise that resolves to the user's input

Parameters

  • $$$$$ (Prompt string) : The question to ask the user, can be anything. (optional, default "")

Returns any A promise that resolves to the user's input.

Example Usage:

// Getting a user's input:
const name = await prompt("What is your name? ");
console.log("Hi", name, "!");

// Working with symbols:
const command = await prompt(">>> ");
console.log(eval(command));

// Working with promises:
prompt("Enter code to eval: ").then((code) => eval(code));

Meta

  • Author: Ramy Hadid

Written and maintained by @rhpo (github.com/rhpo) ❤️.

Package Sidebar

Install

npm i jsprompt

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.2 kB

Total Files

5

Last publish

Collaborators

  • rhpogithub