Skip to content

ecdeveloper/node-named-argv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

node-named-argv

A simple node.js module that helps adding named parameters to a node app call

Installing

npm install named-argv

Usage

You may use both '--' and '-' prefixes for your named parameters:

node myapp.js --opt1=value1 -opt2=value

You may also pass unnamed parameters:

node myapp.js unnamed1 unnamed2

In your code:

var argv = require('named-argv');
console.log(argv.opts); // opts object contains all named parameters 
console.log(argv.params); // array, contains all unnamed parameters

Passing arrays to arguments? Yes, it's possible:

node myapp.js --optarr=val1 --optarr=val2 --optarr=val3

About

A simple node.js module that helps adding named parameters to a node app call

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published