{"size": 873, "ext": "js", "max_stars_repo_path": "src/lib/debug.js", "max_stars_repo_name": "Orisdaddy/darabonba-python-generator", "max_stars_repo_stars_event_min_datetime": "2020-06-16T08:50:27.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-08T08:48:52.000Z", "max_issues_repo_path": "src/lib/debug.js", "max_issues_repo_name": "Orisdaddy/darabonba-python-generator", "max_issues_repo_issues_event_min_datetime": "2020-06-18T08:51:38.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-19T09:01:10.000Z", "max_forks_repo_path": "src/lib/debug.js", "max_forks_repo_name": "Orisdaddy/darabonba-python-generator", "max_forks_repo_forks_event_min_datetime": "2020-06-18T07:21:03.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-31T07:56:50.000Z"}
{"max_stars_count": 11, "max_issues_count": 68, "max_forks_count": 11, "avg_line_length": 15.5892857143, "max_line_length": 69, "alphanum_fraction": 0.5349369989}
'use strict';
const os = require('os');

var count = 0;

function dump(...data) {
  data.forEach(d => {
    console.log(d);
  });
}

function halt(...data) {
  this.dump(...data);
  process.exit(-1);
}

function jump(jumpNumber = 0, ...data) {
  if (count === jumpNumber) {
    this.halt(...data);
    count = 0;
  } else {
    count++;
  }
  return count;
}

function stack(...data) {
  let msg = '';
  if (data[0] && typeof data[0] === 'string') {
    msg = data[0];
    data = data.slice(1);
  }
  this.dump(...data);
  throw new Error(msg);
}

function warning(...data) {
  let msg = '';
  if (data[0] && typeof data[0] === 'string') {
    msg = data[0];
    data = data.slice(1);
  }
  this.dump(...data);
  if (msg.length) {
    process.stdout.write(`\x1b[33m[WARNING] ${msg}\x1b[0m${os.EOL}`);
  }
}

module.exports = {
  dump,
  halt,
  stack,
  jump,
  warning
};
