npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hooked74/prompt

v1.0.1

Published

A beautiful command-line prompt for node.js

Downloads

211

Readme

prompt

A beautiful command-line prompt for node.js

Install

npm install @hooked74/prompt

API

All API methods have an optional options argument. Options has the following fields:

  • answer <String|Boolean> Transmit a answer that will be automatically printed. There will be no user interaction, the answer will be immediately returned.
  • default <String|Number|Boolean|Array|Function> Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers.
  • validate <Function> Receive the user input and answers hash. Should return true if the value is valid, and an error message (String) otherwise. If false is returned, a default error message is provided.
  • filter <Function> Receive the user input and return the filtered value to be used inside the program. The value returned will be added to the Answers hash.
  • transformer <Function> Receive the user input, answers hash and option flags, and return a transformed value to display to the user. The transformation only impacts what is shown while editing. It does not modify the answers hash.
  • when <Function|Boolean> Receive the current user answers hash and should return true or false depending on whether or not this question should be asked. The value can also be a simple boolean.
  • pageSize <Number> Change the number of lines that will be rendered when using list, rawList, expand or checkbox.
  • prefix <String> Change the default prefix message.
  • suffix <String> Change the default suffix message.

promptList(message, choices[, options])

  • message <String> The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of name (followed by a colon).
  • choices <Array> Array values can be simple numbers, strings, or objects containing a name (to display in list), a value (to save in the answers hash) and a short (to display after selection) properties.
  • options <Object>
  • @return <Promise<answer=String>> Answer selected by the user and wrapped in promise.

promptCheckbox(message, choices[, options])

  • message <String> The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of name (followed by a colon).
  • choices <Array> Array values can be simple numbers, strings, or objects containing a name (to display in list), a value (to save in the answers hash) and a short (to display after selection) properties.
  • options <Object>
  • @return <Promise<answer=String>> Answer selected by the user and wrapped in promise.

promptConfirm(message[, options])

  • message <String> The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of name (followed by a colon).
  • options <Object>
  • @return <Promise<answer=Boolean>> Answer selected by the user and wrapped in promise.

promptInput(message[, options])

  • message <String> The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of name (followed by a colon).
  • options <Object>
  • @return <Promise<answer=String>> Answer selected by the user and wrapped in promise.