1.2 KiB
1.2 KiB
gar
The lightweight Node arguments parser
Install
npm i gar
Use
const args = require('gar')(process.argv.slice(2))
console.log(args)
So for: -h hey --toggle -ac --hey=hi -spaced "hey there" -num 1 lone
{
"h": "hey",
"toggle": true,
"a": true,
"c": true,
"hey": "hi",
"spaced": "hey there",
"num": 1,
"_": ["lone"]
}
Why use gar?
gar is way more lightweight than other argument parsing packages.
Here's a size comparison table:
Package | Size |
---|---|
optimist | |
minimist | |
args-parser | |
gar |