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

parameter-descriptors

v0.0.4

Published

Documentation generator for function parameters

Readme

This module produces an html definition list for parameters from a json array.

The JSON array should be of the following form:

[["Arg0","type","Description of Arg0"],
 ["[Arg1]","type","Description of Arg1", "default"]]

Not that the order of the items is important. They must be in the order: name, type, description, default. You don't have to provide all these arguments, but you must not miss one of them out, if you wish to omit one of the values, you can include the empty string for everything except name.

e.g.

[["Arg0", "", "We don't know what type this is"],
 ["Arg2", "descriptionless", "", "0"]];

Public Methods

parse(InputArray)

Parse the input array to produce a new tree which is expanded:

Would turn:

[["Arg0","object"],
 ["Arg1","object","A description of arg1"],
 ["callback(err,resA,resB)","function","The callback",
    ["err","exception","An error if thrown"],
    [["resA","number","A number at random"],
     ["resB","boolean","true or false"]]
 ]]

Into:

[{name:"Arg0",type:"object",desc:" ",defaultVal:" ", children:[]},
 {name:"Arg1",type:"object",desc:"A description of arg1",defaultVal:" ", children:[]},
 {name:"callback(err,resA,resB)",type:"function",desc:"The callback",defaultVal:" ", children:[
     {"children":[],"name":"err","type":"exception","desc":"An error if thrown","defaultVal":" "},
     {"children":[],"name":"resA","type":"number","desc":"A number at random","defaultVal":" "},
     {"children":[],"name":"resB","type":"boolean","desc":"true or false","defaultVal":" "}],
 }]

This nesting can be continued indefinitely.

render(ParsedArray)

Render the output of the parse function as a string. Continuing the previous example would give:

<dl class="param-list">
    <dt class="param-name">Arg0</dt>
    <dd class="param-type param-type-object">object</dd>
    <dd class="param-desc">&nbsp;</dd>
    <dd class="param-default-value">default: &nbsp;</dd>
    <dt class="param-name">Arg1</dt>
    <dd class="param-type param-type-object">object</dd>
    <dd class="param-desc">A description of arg1</dd>
    <dd class="param-default-value">default: &nbsp;</dd>
    <dt class="param-name">callback(err,resA,resB)</dt>
    <dd class="param-type param-type-function">function</dd>
    <dd class="param-desc">The callback</dd>
    <dd class="param-default-value">default: &nbsp;</dd>
    <dd class="param-sub-list">
        <dl class="param-list">
            <dt class="param-name">err</dt>
            <dd class="param-type param-type-exception">exception</dd>
            <dd class="param-desc">An error if thrown</dd>
            <dd class="param-default-value">default: &nbsp;</dd>
            <dt class="param-name">resA</dt>
            <dd class="param-type param-type-number">number</dd>
            <dd class="param-desc">A number at random</dd>
            <dd class="param-default-value">default: &nbsp;</dd>
            <dt class="param-name">resB</dt>
            <dd class="param-type param-type-boolean">boolean</dd>
            <dd class="param-desc">true or false</dd>
            <dd class="param-default-value">default: &nbsp;</dd>
        </dl>
    </dd>
</dl>

This prints out remarcably nicely using the default-styles.css style sheet.

It is also OK in GitHub. If you're looking at the page of this, you'll see it printed nicely, If you're reading the markdown file GitHub, it should at least be readable.

jsonParseAndRender(text)

Does the whole process from a JSON string which it parses, then renders and returns the resulting html.

Default Classes

By default, the following classes are used, but they can be easily overrided.

exports.paramListClass = "param-list";
exports.paramSubListClass = "param-sub-list";
exports.paramNameClass = "param-name";
exports.paramTypeClass = "param-type";
exports.paramDescClass = "param-desc";
exports.paramDefaultClass = "param-default-value";

For any type which contains only letters ([a-zA-Z]*), the type is also given the class

exports.paramTypeClass + "-" + type.toLowerCase()

Typically something like "param-type-array".

Colours for types

The css file has default colourings for the following types:

  • object
  • array
  • number
  • int
  • integer
  • string
  • function
  • boolean
  • regexp