mirror of
https://github.com/Wessel/larg.git
synced 2026-07-21 07:55:35 +02:00
Upload main files
Added: package.json README.md test.js index.js Changed: LICENSE
This commit is contained in:
30
README.md
Normal file
30
README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# larg
|
||||
> A lightweight Node.js argument parser which can be used in various ways
|
||||
|
||||
> [GitHub](https://www.github.com/PassTheWessel/larg) **|** [NPM](https://www.npmjs.com/package/larg)
|
||||
|
||||
## Installing
|
||||
```sh
|
||||
$ yarn add larg # Install w/ Yarn (the superior package manager)
|
||||
$ npm i larg # Install w/ NPM
|
||||
```
|
||||
|
||||
## Usage
|
||||
##### Code
|
||||
```js
|
||||
const argv = require( 'larg' )( process.argv.slice( 2 ) );
|
||||
console.log( argv );
|
||||
```
|
||||
##### Result
|
||||
```sh
|
||||
$ node test.js -x 3 -y 4 -ab --beep=boop foo bar
|
||||
{ _: [ 'foo', 'bar' ],
|
||||
x: 3,
|
||||
y: 4,
|
||||
a: true,
|
||||
b: true,
|
||||
beep: 'boop' }
|
||||
```
|
||||
|
||||
### Why should i use larg?
|
||||
Larg is very lightweight (3.45kb total) comparing to other packages such as optimist and minimist
|
||||
Reference in New Issue
Block a user