get-arguments-lib

Gets argument as switches with double dash, and return a dictionary object

Usage no npm install needed!

<script type="module">
  import getArgumentsLib from 'https://cdn.skypack.dev/get-arguments-lib';
</script>

README

Get arguments as a dictonary object

Instalation

npm

$ npm install get-arguments-lib --save

yarn

$ yarn add get-arguments-lib -S

Usage

$ node <your js  file> --port 3004 --host myHost

const processArguments = getArguments(process.argv);
const port = processArguments.port ? +processArguments.port : 3000;
const host = processArguments.host;

// port value is 3004
// host value is 'myHost'