1.0.0 • Published 4 years ago

pyinput v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

pyinput

JavaScript Style Guide standard-readme compliant

Python-like input module for Node.js

Table of Contents

Install

npm install pyinput # Use yarn if you prefer to use yarn

Usage

Example:

// This is in example folder
const pyInput = require('../src');

const run = async () => {
  let done = false;
  while (!done) {
    const num = await pyInput('Type a number: ');

    const numParsed = parseInt(num);

    if (isNaN(numParsed)) {
      console.log('This is not a number! Try again.');
    } else {
      console.log(`Here is the number that powered: ${numParsed ** 2}`);
      done = true;
    }
  }
};

run();

API

pyInput(...messages) -> {Promise.<string>}

Python-like input

Parameters:

NameTypeAttributesDescription
messagesany<repeatable>Messages that will prints out

Returns:

Recevied input

Type: Promise.<string>

Maintainers

@Helloyunho

Contributing

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2020 Helloyunho