# node-args-parser

> Command line arguments parser for Node.js

Latest version **0.0.1** (published 2017-03-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-args-parser
pnpm add node-args-parser
yarn add node-args-parser
bun add node-args-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2017-03-26 |
| First published | 2017-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dipesh |
| Maintainers | dipesh.singh |
| Keywords | args, parser, commandline |

## Links

- npm: https://www.npmjs.com/package/node-args-parser
- Repository: https://github.com/10uei011/node-args-parser
- Homepage: https://github.com/10uei011/node-args-parser#readme
- Issues: https://github.com/10uei011/node-args-parser/issues
- npm.io page: https://npm.io/package/node-args-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2017-03-26

## README

# node-args-parser

[![Build Status](https://travis-ci.org/10uei011/node-args-parser.svg?branch=master)](https://travis-ci.org/10uei011/node-args-parser)
[![Coverage Status](https://coveralls.io/repos/github/10uei011/node-args-parser/badge.svg?branch=master)](https://coveralls.io/github/10uei011/node-args-parser?branch=master)

Node.js command line arguments parser.

## Install the module

```bash
$ npm install node-args-parser
```

## Usage

Require the module and pass it the `process.argv` arguments array.

```js
const args = require("node-args-parser")(process.argv)

console.info(args)
```
An `object` is returned having a key for each argument given.

For example:

```bash
$ node ./script.js -x 1 -y 2
```

Will return:

```json
{
  "x": 1,
  "y": 1,
}
```

```bash
$ node ./script.js -f -r resource
```

Will return:

```json
{
  "f": true,
  "r": "resource"
}
```

```javascript
if (args.f) {
  console.log("flag 'f' is set")
}
```

## Tests

Run `npm test`

---
_Source: https://npm.io/package/node-args-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
