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

cl-options

v0.0.2

Published

Command line options parser, it accepts options starting with -- and a string of any length and can associate to it a shortcut which will be a letter preceded by one - only. many shortcuts can be bounded after a single dash to form somethign like -abcde where a b c d e are shortcuts for command line options. options are by default optional but they may be set as mandatory, options don't have an expected value by default but they can be set to have one. The settings for the possible options are passed to the constructor as an array of js objects.

Downloads

1

Readme

This class has been created in a couple of hours...maybe less, so it has not been designed properly, however I needed it so here the module for anybody to "enjoy". This is a class which provides features similar to PHP getops, the main class just needs a list of expected parametersas an array of objects. The list of options will look like [ { command : "user", shortcut : "u", hasValue : true }, { command : "password", shortcut : "p", hasValue : true }, ]

The only mandatory key is "command" which is the name of the option and will be parsed when called preceeded by -- so for example we can have

node myfile.js --user john

and the class will parse the pair "--user john" as the option user whith value john. Shortcut is an optional paraeter and allows to define a single character shorten version of the option, for example "u" so that we can rewrite the above example as:

node myfile.js -u john

multiple shortcut may be bound so we can write -adu if we've got a, u and d as valid shortcuts of valid options. The only constrainnt is that if an option expects a value it can't be in the middle of a series of shortcuts. If a and d are shortcuts not expecting a value and u is expecting a value, it is valid to write:

node myfile.js -adu john

but is not valid to do: node myfile.js -aud john

as john is refering to the last of the shortcuts