{"size": 620, "ext": "js", "max_stars_repo_path": "dev/js/src/hint/contextanalyzer.js", "max_stars_repo_name": "KorAP/Kalamar", "max_stars_repo_stars_event_min_datetime": "2015-05-22T08:48:07.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-23T13:41:23.000Z", "max_issues_repo_path": "dev/js/src/hint/contextanalyzer.js", "max_issues_repo_name": "KorAP/Kalamar", "max_issues_repo_issues_event_min_datetime": "2015-05-22T08:49:32.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-14T11:36:06.000Z", "max_forks_repo_path": "dev/js/src/hint/contextanalyzer.js", "max_forks_repo_name": "KorAP/Kalamar", "max_forks_repo_forks_event_min_datetime": "2017-09-26T11:23:54.000Z", "max_forks_repo_forks_event_max_datetime": "2019-10-25T14:13:27.000Z"}
{"max_stars_count": 7, "max_issues_count": 158, "max_forks_count": 2, "avg_line_length": 16.7567567568, "max_line_length": 52, "alphanum_fraction": 0.5709677419}
/**
 * Regex object for checking the context of the hint
 */
"use strict";

define({

  /**
   * Create analyzer based on regular expression.
   */
  create : function (regex) {
    return Object.create(this)._init(regex);
  },

  // Initialize analyzer
  _init : function (regex) {
    try {
      this._regex = new RegExp(regex);
    }
    catch (e) {
      KorAP.log(0, e);
      return;
    };
    return this;
  },

  /**
   * Check a context based on the analyzer
   * and return a valid context string.
   */
  test : function (text) {
    if (!this._regex.exec(text))
      return;
    return RegExp.$1;
  }
});
