1.0.0 • Published 11 months ago

@jmrl23/node-prompt v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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();
1.0.0

11 months ago