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

cli2obj

v1.0.0

Published

cli args parser with multi format

Downloads

10

Readme

cli2obj

A simple cli args parser with multi format

多种格式的命令行解析器

A good util for cli application develope

install

npm install cli2obj

usage

include

var cli = require("cli2obj")

该类库支持4种命令行格式

This lib has 4 format args parser.

横线两参数

Line type

CLI like node app -p 80 --host google.com name foo

var args = cli.parseLine()

This result is

{"p": 80, "host": "google.com", "name": "foo"}

等号赋值

Equal type

CLI like node app -port=80 --dir=/root name=foo

var args = cli.parseEqual()

This result is

{"port": 80, "dir": "/root", "name": "foo"}

按位置键值对

Flat type

CLI like node app install foobar

if you want to parse "operate" as "install" and "name" as "foobar",

use this

var args = cli.parseFlat(["operate", "name"])

This result is

{"operate": "install", "name": "foo"}

以上3种混合

Mix type

CLI mix all format like node app install --dir=/root -log foo.log t=dev,

and you want to parse "operate" as "install",

use this

var args = cli.parseMix(["operate"])

This result is

{"operate": "install", "dir": "/root", "log": "foo.log", "t": "dev"}

Others

本类库为本人业余时间开发,难免存在各种错漏bug,如有发现bug或有更好的建议,欢迎向本人提出,互相交流。Email