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

simplifyprompt

v1.0.2

Published

A package for create a simle prompt

Downloads

1

Readme

SimplifyPromptJS

Introduction

With this package, you will be able to create prompts to interact with the command line in a simple way.

You can customize your indicator with numerous options and create commands too easy.

new Prompt(PromptConstructorOptions)

With this class, you can create your own prompt.

| Param | Description | Default | | - | - | - | PromptConstructorOptions | The constructor options for this prompt | PromptConstructorOptions (default value)

Check the types part to see more information

<prompt>.addCommands(...commands):this

Add commands to the prompt.

| Param | Description | Default | Type | | - | - | - | - | | commands | The list of commands to add | undefined \| [] | ...CommandsOptions | Array<CommandsOptions>

Usage:

const prompt = new Prompt(/*Options*/);

prompt.addCommands(
    {
        name: 'install',
        aliases: ['i'],
        description: 'Install a package'
    }
);

<prompt>.reply(args?):ReplyResponse

Reply to a prompt interation.

| Param | Description | Default | Type | | - | - | - | - | | args | The args of the prompt | process.argv | string |

Usage:

const prompt = new Prompt(/*Options*/);

let interaction = prompt.reply();

Types

PromptConstructorOptions

| Property | Description | Type | Default | Required | - | - | - | - | - | | commands | The commands of this prompt | Array<CommandsOptions> |[] | ❌ | prefix | The prefix options for this prompt | PrefixOptions | PrefixOptions (default value) | ❌ | options | The options for this prompt | PromptOptions | {} | ❌

CommandsOptions

| Property | Description | Type | Default | Required | - | - | - | - | - | | name | The name of the command | string | undefined | ✅ | aliases | The aliases of this command | Array<string> | [] | ❌ | description | The description of this command | string | null | ❌ | options | The options of this command | Array<CommandOptions> | [] | ❌ | action | The action of this command. Launched when the command is invoked | CommandFunction() | () => {} | ❌ | type | The type of the value | "string" | "boolean" | "number" | "any" | "any" | ❌ | required | If the value of the command is required | boolean | false | ❌

CommandOptions

| Property | Description | Type | Default | Required | - | - | - | - | - | | name | The name of this option | string | undefined | ✅ | aliases | The aliases of this option | Array<string> | [] | ❌ | description | The description of this option | string | null | ❌ | type | The type of this option | "string" | "number" | "boolean" | "any" | "any" | ❌ | action | The action of this option. Launched when the option is invoked | OptionFunction() | () => {} | ❌

CommandFunction

| Param | Description | Type | Required | - | - | - | - | | options | The data of this function | CommandFunctionProperties | ❌

CommandFunctionProperties

| Property | Description | Type | Default | - | - | - | - | | args | The arguments of this interaction | Array<undefined> | [string, string | number | boolean][] | Array\<undefined> | commandValue | The value of this interaction | string | number | boolean | undefined

OptionFunction

| Param | Description | Type | Required | - | - | - | - | | options | The data of this function | OptionFunctionProperties | ❌

OptionFunctionProperties

| Property | Description | Type | Default | | - | - | - | - | | value | The value of this option | string | boolean | number | undefined | commandValue | The value of the interaction | string | number | boolean | undefined

PrefixOptions

| Property | Description | Type | Default | Required | - | - | - | - | - | | large | The large prefix for complete option name | string | -- | ❌ | sort | The sort prefix for alias option | string | - | ❌

PromptOptions

| Property | Description | Type | Default | Required | - | - | - | - | - | | errorMessages | A object with all error messages | ErrorMessages | {} | ❌

ErrorMessages

| Property | Description | Type | Default | Required | - | - | - | - | - | COMMAND_DOESNT_EXIST | Invoked when a command doesn't exist | string | "The command does not exist!" | ❌ | MALFORMED_COMMAND | Invoked when a command have bad sintaxis | string | "The command sintaxis isn't correct!" | ❌ | WRONG_DATA_TYPE | Invoked when you provide a incorrect data type in a command or option | string | "The option "{name}" wants this type: {type}" | ❌ | REQUIRED_VALUE | Invoked when the value of the command or options is required and the value is undefined | string | "The command value is required!" | ❌ |

ReplyResponse

| Property | Description | Type | | - | - | - | commandName | The name of the launched command | string | | value | The value of the interaction | string | number | boolean | | arguments | The arguments of this interaction | Array<undefined> | [string, string | number | boolean][]