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

dot-argv

v0.2.7

Published

A command-line argument helper that allows complex keys (JSON dot paths) and complex values (valid JSON).

Readme

node-dot-argv

A command-line argument helper for Node.js that turns complex argument keys (with dot paths) into objects with JSON parsed values. Use inspired by ecdeveloper's very useful named-argv.

Installing

npm install dot-argv

Usage

Execute:

node app.js param0 --opt1 value1 -opt2 val=ue2 -opt3 \"value3\" -opt4.a.x [3,\"ok\",false] -opt5\\.z {\"b\":3} par\\=am1 {\"c\":3}

Where, in app.js:

var argv = require('dot-argv');
console.log(argv.opts); 
console.log(argv.params);

Which gives argv.opts as:

{
    "opt1": "value1",
    "opt2": "val=ue2",
    "opt3": "value3",
    "opt4": {
        "a": {
            "x": [ 3, "ok", false ]
        }
    }, 
    "opt5.z": {
        "b": 3
    }
}

And argv.params as:

[ "param0", "par=am1", { "c": 3 } ]

Extras

val

Read or write a value in an object by its dotted path. E.g. with the argv.opts from the usage example:

argv.val(argv.opts, "opt4.a.x"); // returns [ 3, "ok", false ]
argv.val(argv.opts, "opt4.a.x", 1000); // writes the value

argv.val(argv.opts, "opt5\\.z.b"); // returns 3
argv.val(argv.opts, "opt5\\.z.b", 4); // writes the value

collapse/expand

Collapse an object into a single level. E.g. with the argv.opts from the usage example:

argv.collapse(argv.opts);

Returns:

{
    "opt1": "value1",
    "opt2": "val=ue2",
    "opt3": "value3",
    "opt4.a.x.0": 3,
    "opt4.a.x.1": "ok",
    "opt4.a.x.2": false,
    "opt5\\.z.b": 3
}

Recreate the structure with:

argv.expand(flat);

Which returns a copy of the original object, argv.opts.

overwrite

Write properties in one object into another. Useful if you have an object containing default values that need to be partially overwritten. E.g. writing argv.opts into a defaults object:

var defaults = {
    "opt1": "default value1",
    "opt4": {
        a: false;
    },
    "opt6": 1000
};

var opts = argv.overwrite(argv.opts, defaults);

Then opts is:

{
    "opt1": "value1",
    "opt2": "val=ue2",
    "opt3": "value3",
    "opt4": {
        "a": {
            "x": [ 3, "ok", false ]
        }
    }, 
    "opt5.z": {
        "b": 3
    },
    "opt6": 1000 // this property is preserved from defaults object 
}

arrayify

Create an array of command-line option strings. E.g. with the argv.opts in the usage example:

argv.arrayify(argv.opts);

Returns an array of the collapsed form, with JSON.stringify()'d values:

[
    '"param0"', 
    '"par\\=am1"', 
    '{"c":3}',
    'opt1', '"value1"',
    'opt2', '"val=ue2"',
    'opt3', '"value3"',
    'opt4.a.x.0', '3',
    'opt4.a.x.1', '"ok"',
    'opt4.a.x.2', 'false',
    'opt5\\.z.b', '3'
]

Order of the keyed options is not guaranteed.

stringify

Similar to arrayify, but returns a string. E.g. with the argv.opts in the usage example:

argv.arrayify(argv.opts);

Returns the string:

'"param0" "par\\=am1" {"c":3} --opt1 "value1" -opt2 "val=ue2" -opt3 "value3" -opt4.a.x.0 3 -opt4.a.x.1 "ok" -opt4.a.x.2 false -opt5\.z.b 3'