nanoparse

1.0.0 • Public • Published

nanoparse

The tiniest argument parser. No fluff!

import nanoparse from 'nanoparse'

const argv = nanoparse(process.argv.slice(2));
console.log(argv)
$ node test.js -a beep -b boop
{ flags: { a: 'beep', b: 'boop' }, _: [], extras: [] }
$ node test.js -h 3 -w 4 -abc --beep=boop foo bar baz -xyz=2 --no-that --why because -- --no more -parse
{
  flags: {
    h: 3,
    w: 4,
    a: true,
    b: true,
    c: true,
    beep: 'boop',
    z: 2,
    x: true,
    y: true,
    that: false,
    why: 'because'
  },
  _: [ 'foo', 'bar', 'baz' ],
  extras: [ '--no', 'more', '-parse' ]
}

Too low-level? There's a framework coming up!

Install

$ npm install nanoparse

Note: This package is pure ESM

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    13
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    13

Package Sidebar

Install

npm i nanoparse

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

4.92 kB

Total Files

5

Last publish

Collaborators

  • siddharthshyniben