{"size": 896, "ext": "js", "max_stars_repo_path": "src/helpers/wrappers/ExtendedMap.js", "max_stars_repo_name": "nodecp/nodecp", "max_stars_repo_stars_event_min_datetime": "2019-05-19T01:18:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-02T19:55:39.000Z", "max_issues_repo_path": "src/helpers/wrappers/ExtendedMap.js", "max_issues_repo_name": "nodecp/nodecp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/helpers/wrappers/ExtendedMap.js", "max_forks_repo_name": "nodecp/nodecp", "max_forks_repo_forks_event_min_datetime": "2019-06-21T06:06:19.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-21T06:06:19.000Z"}
{"max_stars_count": 9, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 14.6885245902, "max_line_length": 49, "alphanum_fraction": 0.5189732143}
module.exports = class extends Map {
  constructor() { super() }

  ensure(key, value) {
    return this.get(key) || this.set(key, value);
  }

  setProp(key, filter, value) {
    let data = super.get(key);

    if (!data) data = {};

    data[filter] = value;

    return this.set(key, data);
  }

  set(key, value) {
    super.set(key, value);

    return super.get(key);
  }

  keyArray() {
    return Array.from(this.keys());
  }

  valueArray() {
    return Array.from(this.values());
  }

  find(fn) {
    for (var [key, val] of this) {
      if (fn(val))
        return val;
    }

    return null;
  }

  filter(fn) {
    let results = [];
    
    for (var [key, val] of this) {
      if (fn(val))
        results.push(val);
    }

    return results;
  }

  map(fn) {
    let results = [];

    for (var [key, val] of this) {
      results.push(fn(val))
    }

    return results;
  }
}