@jmrl23/node-prompt
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Node-Prompt

Make console prompt

Usage

import { Prompt } from './main';

async function main() {
  const prompt = new Prompt(/** Partial<ReadLineOptions>? */);

  prompt.use((input) => input.toLowerCase() /**, ...modifiers */);

  const username = await prompt.ask('username: ').asString(
    (input) => {
      if (!input.startsWith('@')) input = `@${input}`;
      return input;
    } /**, ...modifiers */
  );

  const password = await prompt
    .ask('password: ', {
      useModifiers: false,
      hide: {
        placeholder: '*',
      },
    })
    .asString();

  console.log({ username, password });
}

void main();

Package Sidebar

Install

npm i @jmrl23/node-prompt

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

32 kB

Total Files

15

Last publish

Collaborators

  • jmrl23