{"size": 847, "ext": "js", "max_stars_repo_path": "src/structures/SkyBlock/News/SkyblockNews.js", "max_stars_repo_name": "StavZ/hypixel-api-reborn", "max_stars_repo_stars_event_min_datetime": "2020-02-02T08:32:18.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-20T15:19:17.000Z", "max_issues_repo_path": "src/structures/SkyBlock/News/SkyblockNews.js", "max_issues_repo_name": "StavZ/hypixel-api-reborn", "max_issues_repo_issues_event_min_datetime": "2020-02-18T14:01:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-28T08:07:05.000Z", "max_forks_repo_path": "src/structures/SkyBlock/News/SkyblockNews.js", "max_forks_repo_name": "StavZ/hypixel-api-reborn", "max_forks_repo_forks_event_min_datetime": "2020-02-18T13:51:24.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-19T22:14:02.000Z"}
{"max_stars_count": 11, "max_issues_count": 182, "max_forks_count": 10, "avg_line_length": 19.6976744186, "max_line_length": 82, "alphanum_fraction": 0.5501770956}
const dateRegExp = /(\d{1,2})(?:st|nd|rd|th|) ([A-z]+) (\d+)/;
/**
 * SkyblockNews
 */
class SkyblockNews {
  /**
   * @param {object} data
   */
  constructor (data) {
    /**
     * Title
     * @type {string}
     */
    this.title = data.title;
    /**
     * Thread
     * @type {string}
     */
    this.link = data.link;
    /**
     * Raw Date from the API Response
     * @type {string}
     */
    this.rawDate = data.text;
    /**
     * Parsed Date
     * @type {Date}
     */
    this.date = parseDate(data.text);
  }
}
/**
 * Parses a string date
 * @param {string} stringDate
 * @returns {Date | null}
 */
function parseDate(stringDate) {
  const matched = stringDate.match(dateRegExp);
  if (!matched) return null;
  return new Date(matched.slice(1).join(' ')); // Ok this is lazy, but should work
}
module.exports = SkyblockNews;
