easylinedeprecated

simple wrapper around readline to make asking questions super simple

Usage no npm install needed!

<script type="module">
  import easyline from 'https://cdn.skypack.dev/easyline';
</script>

README

easyline

NPM version License Code style

simple promise readline wrapper

Installation

$ npm install --save easyline

...or:

$ yarn add easyline

Usage

const easyline = require('easyline')

;(async function main () {
  // question
  const name = await easyline.question('Name?')

  // question with default value
  const greeting = await easyline.question('Greeting?', 'hello')

  // yes or no
  const greet = await easyline.yesNo('Greet?')

  if (greet) {
    console.log(`${greeting} ${name}`)
  }

  process.exit()
}())

Example