Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
console.log("\n")
}
const subscribe = (opt,totalAvgMsgRecived,duraion,avgConTime)=>{