Skip to content

SiddharthShyniben/nanoparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nanoparse

A tiny (1kb!) 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

About

Tiny arg parser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published