# n-args

> Lightweight node js cli argument parser and validator

Latest version **1.0.2** (published 2017-10-01) · 0 weekly downloads

## Install

```sh
npm install n-args
pnpm add n-args
yarn add n-args
bun add n-args
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-10-01 |
| First published | 2017-10-01 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matthew Nitschke |
| Maintainers | mnitschke |

## Links

- npm: https://www.npmjs.com/package/n-args
- npm.io page: https://npm.io/package/n-args

## Recent versions

- 1.0.2 (latest) — 2017-10-01
- 1.0.1 — 2017-10-01
- 1.0.0 — 2017-10-01

## README

# nargs
a lightweight argument parser and validator for node js cli applications


# Usage
```javascript
var nargs = require('../src/nargs.js');

var args = nargs.parse({
  prefix: { // prefix based arguments
    "-f": {
      name: "foo",
      type: nargs.Integer,
      default: 12
    }
  },
  index: [{ // index based arguments
     name: "faa",
     type: nargs.String,
     validator: /([0-9.]+)/g,
     invalidMessage: "Invalid string format"
  }]
});


// { foo: 12, faa: '192.168.0.1'}

```

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