{"size": 1237, "ext": "js", "max_stars_repo_path": "lib/ev.js", "max_stars_repo_name": "xavigonz/reactive-modal", "max_stars_repo_stars_event_min_datetime": "2015-02-19T20:41:27.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-14T16:23:57.000Z", "max_issues_repo_path": "lib/ev.js", "max_issues_repo_name": "xavigonz/reactive-modal", "max_issues_repo_issues_event_min_datetime": "2015-01-08T20:13:08.000Z", "max_issues_repo_issues_event_max_datetime": "2016-02-12T07:05:29.000Z", "max_forks_repo_path": "lib/ev.js", "max_forks_repo_name": "xavigonz/reactive-modal", "max_forks_repo_forks_event_min_datetime": "2015-02-20T01:21:33.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-05T09:20:10.000Z"}
{"max_stars_count": 17, "max_issues_count": 16, "max_forks_count": 11, "avg_line_length": 24.2549019608, "max_line_length": 72, "alphanum_fraction": 0.6677445432}
EV = function() {
  this._evHandlers = {};
}

EV.prototype.emit = function emit(event) {
  var args = Array.prototype.slice.call(arguments, 1);
  var emitted = false;

  if(this._evHandlers[event]) {
    var events = _.clone(this._evHandlers[event]);
    for(var lc=0; lc<events.length; lc++) {
      var handler = events[lc];
      handler.apply(this, args);
      emitted = true;
    }
  }

  if(event == 'error' && !emitted) {
    throw args[0];
  }
  return this;
};

EV.prototype.on = function on(event, callback) {
  if(!this._evHandlers[event]) {
    this._evHandlers[event] = [];
  }
  this._evHandlers[event].push(callback);
  return this;
};

EV.prototype.once = function once(event, callback) {
  this.on(event, function onetimeCallback() {
    callback.apply(this, arguments);
    this.removeListener(event, onetimeCallback);
  });
  return this;
};

EV.prototype.removeListener = function removeListener(event, callback) {
  if(this._evHandlers[event]) {
    var index = this._evHandlers[event].indexOf(callback);
    var removed = this._evHandlers[event].splice(index, 1);
  }
  return this;
};

EV.prototype.removeAllListeners = function removeAllListeners(event) {
  this._evHandlers[event] = undefined;
  return this;
};