{"size": 683, "ext": "js", "max_stars_repo_path": "src/index.js", "max_stars_repo_name": "jmlntw/google-supported-domains", "max_stars_repo_stars_event_min_datetime": "2020-07-20T05:22:36.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-30T01:19:34.000Z", "max_issues_repo_path": "src/index.js", "max_issues_repo_name": "jmlntw/google-supported-domains", "max_issues_repo_issues_event_min_datetime": "2022-03-10T02:46:24.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-10T04:33:50.000Z", "max_forks_repo_path": "src/index.js", "max_forks_repo_name": "jmlntw/google-supported-domains", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 22.0322580645, "max_line_length": 68, "alphanum_fraction": 0.5812591508}
const { domains } = require('./domains')

module.exports = {
  /**
   * Returns all Google supported domains.
   * @public
   * @returns {string[]} Returns all domains as a string array.
   */
  all: function all () {
    return domains
  },

  /**
   * Tests if `domain` is a Google domain.
   * @public
   * @param {string} domain The domain to test.
   * @returns {boolean} Returns true if `domain` is a Google domain.
   */
  test: function test (domain) {
    const parts = domain.toLowerCase().split('.')

    while (parts.length) {
      if (parts.shift() === 'google') {
        return domains.indexOf(`.google.${parts.join('.')}`) >= 0
      }
    }

    return false
  }
}
