Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env node
var fs = require('fs');
var child_process = require('child_process');
var Table = require('easy-table')
// add our own ".total()" method on the Table object
Table.prototype.totals = function(keys, label) {
keys = keys || Object.keys(this.columns);
label = label || 'Totals';
var totals = {};
var ii, jj, key;
for (ii in this.rows) {
var line = this.rows[ii];
for (jj in keys) {
key = keys[jj];
var val = line[key];
if (typeof val === 'number') {
totals[key] = (totals[key] || 0) + val;
}
}
}
// then totals
var first = true;