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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kidzboptions

v0.10.0

Published

Lightweight and easy command line option parsing.

Readme

kidzboptions

Lightweight and easy command-line option parsing.

Usage

const kidzboptions = require('kidzboptions');

const options = kidzboptions.parse({
    info: "Demonstrates how to use kidzboptions",
    version: "1.0.0",
    options: {
        // Object keys are long options. This becomes the long option --first-name
        "first-name": {
            // currently supported types are "string" or "boolean"
            type: "string",

            // if not specified, short option is automatically generated
            // from first character of long option
            short: "f",

            // description is optional
            description: "User's first name"
        },
        "last-name": {
            type: "string",
            description: "User's last name",

            // Unless specified, all options are optional
            required: true
        },
        "dog-lover": {
            // If not specified, type defaults to "boolean"

            description: "User loves dogs"
        },
        "cat-lover": {
            description: "User loves cats"
        }
    },
    // Positional arguments can be named
    positional: ["input-file", "output-file"]
});

API

kidzboptions.parse({ info, version, options, positional })

This is the easiest way to parse options. You pass in a configuration describing the options you want, and get back an object with option values keyed by option name.

Options for --help and --version are automatically added. If specified, kidzboptions will print usage or version information and exit the process with a zero error code.

If the passed options are invalid (say, a string option was not given a value), kidzboptions will print an error & usage information, and exit the process with a non-zero error code.

All configuration properties are optional:

  • info: a string describing this program, which is printed with the usage text
  • version: the program version, printed if the --version option is given
  • options: an object describing your command line options. See below.
  • positional: an array of strings that will be used to name anonymous (positional) arguments to your program

Option specification

In the option schema, object keys automatically become the long form of your options. Every option must have a long form. The following properties are supported (all optional).

  • description: A string to be printed in the usage text to describe this option. Defaults to no description.

  • type: Can be "string" to indicate that an option requires a value or "boolean" to indicate that it does not.

    String option values may be passed with the short form -a value or the long form --a-long-option=value. Defaults to "boolean".

    Boolean options can be specified multiple times, which will cause the value to be flipped each time it occurs.

  • short: A single-character string specifying the short option. Defaults to the first character of the long option, unless it conflicts with another option, in which case the option will have no short version.

  • required: A boolean indicating that an option value must be provided. Only applies to string options. Defaults to false.

kidzboptions.parser()

If you need more control over the result of your parsing, this method takes the same arguments as options but returns a parser that you can call manually with the following functions.

parser.parse(arg)

Parses an ARGV array and returns the result. The result object has these properties:

  • help: true if the --help option was specified
  • version: true if the --version option was specified
  • errors: an array of strings containing any validation errors
  • result: The parsed options. This is the same object you get back from options() if parsing succeeds.

parser.usage()

Gets the usage text, generated from the option schema.

parser.version()

Gets the version text, generated from the option schema.