Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-prompts-web3

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-prompts-web3

Lightweight, beautiful and user-friendly prompts and live on Webiste. With future web3 very simple library

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

❯ Install

$ npm install --save simple-prompts-web3

This package supports Node 14 and above

❯ Usage

const simple-prompts-web3 = require('simple-prompts-web3');

(async () => {
  const response = await simple-prompts-web3({
    type: 'number',
    name: 'value',
    message: 'How old are you?',
    validate: value => value < 18 ? `Nightclub is 18+ only` : true
  });

  console.log(response); // => { value: 24 }
})();

❯ Examples

Single Prompt

Prompt with a single prompt object. Returns an object with the response.

const simple-prompts-web3 = require('simple-prompts-web3');

(async () => {
  const response = await simple-prompts-web3({
    type: 'text',
    name: 'meaning',
    message: 'What is the meaning of life?'
  });

  console.log(response.meaning);
})();

Prompt Chain

Prompt with a list of prompt objects. Returns an object with the responses. Make sure to give each prompt a unique name property to prevent overwriting values.

const simple-prompts-web3 = require('simple-prompts-web3');

const questions = [
  {
    type: 'text',
    name: 'username',
    message: 'What is your GitHub username?'
  },
  {
    type: 'number',
    name: 'age',
    message: 'How old are you?'
  },
  {
    type: 'text',
    name: 'about',
    message: 'Tell something about yourself',
    initial: 'Why should I?'
  }
];

(async () => {
  const response = await simple-prompts-web3(questions);

  // => response => { username, age, about }
})();

Dynamic simple-prompts-web3

Prompt properties can be functions too. Prompt Objects with type set to falsy values are skipped.

const simple-prompts-web3 = require('simple-prompts-web3');

const questions = [
  {
    type: 'text',
    name: 'dish',
    message: 'Do you like pizza?'
  },
  {
    type: prev => prev == 'pizza' ? 'text' : null,
    name: 'topping',
    message: 'Name a topping'
  }
];

(async () => {
  const response = await simple-prompts-web3(questions);
})();

Keywords

FAQs

Package last updated on 29 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc