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

confirmation

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

confirmation

A confirmation window for Node scripts.

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
increased by52.96%
Maintainers
1
Weekly downloads
 
Created
Source

⁉️ confirmation

A simple Node tool to have Browser's confirm popup on your CLI.

confirmation

Installation

yarn add confirmation

Usage

In an async function just call await confirmation.

if (await confirmation('Are you sure?')) {
  console.log('Yay!');
} else {
  console.log('Oops!');
}

API

await confirmation(message) : bool

Shows a message and OK and Cancel buttons.

Example:

const result = await confirmation('You will delete your items, are you sure?')

await confirmation(title, message) : bool

Shows a message with a title and OK and Cancel buttons.

Example:

const result = await confirmation('Warning', 'You will delete your items, are you sure?')

await confirmation(title, message, ok, cancel) : bool

Shows a message with a title and custom OK and custom Cancel buttons.

Example:

const result = await confirmation(
  'Warning',
  'You will delete your items, are you sure?',
  'I am sure',
  'No!'
)

The Key bindings

The Y for OK and N for Cancel are the default key bindings.

When you customize your OK and Cancel buttons, the first letter will be the key binding. If you make I am Sure instead of OK, you'll need to press I to confirm.

Example 1

Example:

const result = await confirmation(
  'Warning',
  'You will delete your items, are you sure?',
  '[O] OK',
  '[X] Close'
)

Keymap:

  • O to Confirm
  • X to Close

Example 2

Example:

const result = await confirmation(
  'Warnin\'',
  'Ye will scuttle yer items, are ye sure?',
  'Aye',
  'No'
)

Keymap:

  • A (_A_ye) to Confirm
  • N (_N_o) to Close

License

MIT © Fatih Kadir Akin

Keywords

FAQs

Package last updated on 24 Feb 2019

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