{"size": 1263, "ext": "js", "max_stars_repo_path": "star.script.js", "max_stars_repo_name": "CBNU-CMI/cbnu-cafeteria-menus-scraper", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "star.script.js", "max_issues_repo_name": "CBNU-CMI/cbnu-cafeteria-menus-scraper", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "star.script.js", "max_forks_repo_name": "CBNU-CMI/cbnu-cafeteria-menus-scraper", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.2884615385, "max_line_length": 97, "alphanum_fraction": 0.5368171021}
function getData() {
  function getStartDate() {
    return new Date(
      document
        .querySelector(
          `#sub_right > div:nth-child(3) > div > p:nth-child(1) > font:nth-child(2) > sup > span`
        )
        .innerText.replace(/[\(년월일]/g, "")
        .replace(/\ /g, ".")
    );
  }

  function getFoodList() {
    const nodelist = document.querySelectorAll(
      "#sub_right > div:nth-child(4) > div > table > tbody > tr:nth-child(2) > td"
    );

    const foodlist = [...nodelist];
    return foodlist.splice(2, 6).map((food) => food.innerText);
  }

  const twoDigit = (num) => {
    return num < 10 ? `0${num}` : num;
  };

  const dateFormat = (date) => {
    const d = new Date(date);
    return `${d.getFullYear()}-${twoDigit(d.getMonth() + 1)}-${twoDigit(
      d.getDate()
    )}`;
  };

  const foodList = getFoodList();
  const startDate = getStartDate();
  const week = ["월", "화", "수", "목", "금"];
  let data = [];
  for (let i = 0; i < foodList.length; i++) {
    data.push({
      restaurant_name: "별빛식당",
      food_name: foodList[i],
      day: week[i],
      date: dateFormat(
        new Date(startDate.setDate(startDate.getDate() + (i ? 1 : 0)))
      ),
      time: 2,
    });
  }
  return data;
}

module.exports = getData;
