How to use the minimist.d function in minimist

To help you get started, we’ve selected a few minimist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hareeqi / mqtt-benchmark / print.js View on Github external
const isdebug = require('minimist')(process.argv.slice(2)).d;
const round = (n)=> Math.round(n* 10000) / 10000
const debug = (...arg)=>isdebug && console.log(...arg);

const publish = (opt,results,avgConTime)=>{
  console.log(`\n\tAverage result for each client of the ${opt.clients} clients.\n `);
  console.log("\tEstablishing connection (sec):\t",round(avgConTime));
  console.log(`\tSuccess in publishing (msg):\t ${round(results.reduce((a,b)=>(a+b.success),0)/results.length)}/${opt.count}`);
  console.log(`\tFailure in publishing (msg):\t ${round(results.reduce((a,b)=>(a+b.failure),0)/results.length)}/${opt.count}`);
  console.log("\tDuraion in publishing (sec):\t",round(results.reduce((a,b)=>(a+b.duraion),0)/results.length));
  console.log("\tThroughput (msg/sec):     \t",round(results.reduce((a,b)=>(a+b.throughput),0)/results.length));

const subscribe = (opt,totalAvgMsgRecived,duraion,avgConTime)=>{