Skip to content

Instantly share code, notes, and snippets.

@YuriFontella
Created October 22, 2019 02:32
Show Gist options
  • Select an option

  • Save YuriFontella/b0fa9c6ca130e020b44569fad9bd64b5 to your computer and use it in GitHub Desktop.

Select an option

Save YuriFontella/b0fa9c6ca130e020b44569fad9bd64b5 to your computer and use it in GitHub Desktop.
'use strict'
const readline = require('readline')
module.exports = hint => {
return new Promise((resolve, reject) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
rl.question(hint, input => {
rl.close()
resolve(input)
})
}).catch(console.log)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment