{"size": 724, "ext": "js", "max_stars_repo_path": "lib/extend/helper.js", "max_stars_repo_name": "wlphp/hexo-1", "max_stars_repo_stars_event_min_datetime": "2015-01-01T08:06:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T22:05:55.000Z", "max_issues_repo_path": "lib/extend/helper.js", "max_issues_repo_name": "wlphp/hexo-1", "max_issues_repo_issues_event_min_datetime": "2015-01-01T01:21:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T17:28:31.000Z", "max_forks_repo_path": "node_modules/hexo/lib/extend/helper.js", "max_forks_repo_name": "SHINZAMONO/Morning_v0.0.1", "max_forks_repo_forks_event_min_datetime": "2015-01-01T05:07:53.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T13:09:40.000Z"}
{"max_stars_count": 35651, "max_issues_count": 4087, "max_forks_count": 6371, "avg_line_length": 19.0526315789, "max_line_length": 79, "alphanum_fraction": 0.5939226519}
'use strict';

class Helper {
  constructor() {
    this.store = {};
  }

  /**
   * @returns {Object} - The plugin store
   */
  list() {
    return this.store;
  }

  /**
   * Get helper plugin function by name
   * @param {String} name - The name of the helper plugin
   * @returns {Function}
   */
  get(name) {
    return this.store[name];
  }

  /**
   * Register a helper plugin
   * @param {String} name - The name of the helper plugin
   * @param {Function} fn - The helper plugin function
   */
  register(name, fn) {
    if (!name) throw new TypeError('name is required');
    if (typeof fn !== 'function') throw new TypeError('fn must be a function');

    this.store[name] = fn;
  }
}

module.exports = Helper;
