1.0.0 • Published 4 years ago
pyinput v1.0.0
pyinput
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
Contributing
PRs accepted.
Small note: If editing the README, please conform to the standard-readme specification.
License
MIT © 2020 Helloyunho
1.0.0
4 years ago