Socket
Socket
Sign inDemoInstall

params-cli

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    params-cli

Easily extract CLI parameters for your Node application


Version published
Weekly downloads
13
Maintainers
1
Install size
4.84 kB
Created
Weekly downloads
 

Readme

Source

Easily extract CLI parameters when invoking your NodeJS script.

Instead of manually extracting parameters from process.argv, this package returns an object of parameters and values of your script invoke.

Install

$ npm install --save params-cli

Usage

Suppose you have your script called app.js, with the following:

const params = require('params-cli');

console.log(params.script());

console.log(params.has('x'));
console.log(params.get('x'));

console.log(params.has('y'));
console.log(params.get('y'));

Running your script with parameters returns the following:

$ node app.js x=abc123

/path/to/your/app.js
true
abc123
false
undefined

Contributing

Make sure to not break tests, by running npm run test:watch.

To continousely build using babel, run npm run dev.

Thanks. H

Keywords

FAQs

Last updated on 04 Nov 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc