3.0.0 • Published 2 years ago

stdinput-js v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

stdin-js

A library that provide a python like input function. Its async so it should be used within an async context.

Example usage

import { stdinput } from "stdinput-js";
// or
const { stdinput } = require("stdinput-js");

async function main() {
    const name = await stdinput("What's your name?");
    console.log(`Hello, ${name}`);
}

main();

Why?

To teach JavaScript like any other programming language out there you will use stdin sooner or later.

Who would want to take input like this?

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question("What's your name?  ", function(answer) {
   console.log("Hello " + answer);
   rl.close();
});
3.0.0

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago