@shinigami_dev/console.input

An easy package to interact with user input inside the console.

Usage no npm install needed!

<script type="module">
  import shinigamiDevConsoleInput from 'https://cdn.skypack.dev/@shinigami_dev/console.input';
</script>

README

usage

basic usage

const { input, output } = require('@shinigami_dev/console.input');

const question = input('Name? ');
// Console logs: Name?
output(`name: ${question}`);
// Console logs: Name? <input>
  • input() & output() are logged in the order they are defined.

input

const { input } = require('@shinigami_dev/console.input');

const question = input('Name? ')
// Console logs: Name?
// After input is entered the proccess is exited if output() is not called.

output

const { input, output } = require('@shinigami_dev/console.input');

const question = input('Name? ');
// Console logs: Name?
output(`name: ${question}`);
// Console logs: Name? <input>
// Input needs to be called for output() to function.