pyinput

1.0.0 • Public • Published

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:

Name Type Attributes Description
messages any <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

Readme

Keywords

none

Package Sidebar

Install

npm i pyinput

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.49 kB

Total Files

10

Last publish

Collaborators

  • helloyunho