{"size": 706, "ext": "js", "max_stars_repo_path": "web_dynamic/static/scripts/1-hbnb.js", "max_stars_repo_name": "PierreBeaujuge/AirBnB_clone_v4", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "web_dynamic/static/scripts/1-hbnb.js", "max_issues_repo_name": "PierreBeaujuge/AirBnB_clone_v4", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web_dynamic/static/scripts/1-hbnb.js", "max_forks_repo_name": "PierreBeaujuge/AirBnB_clone_v4", "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": 32.0909090909, "max_line_length": 68, "alphanum_fraction": 0.5637393768}
$(document).ready(function () {
  const amenities = {};
  $('input[type="checkbox"]').click(function () {
    const amenityId = $(this).attr('data-id');
    const amenityName = $(this).attr('data-name');
    if ($(this).prop('checked') === true) {
      amenities[amenityId] = amenityName;
    } else if ($(this).prop('checked') === false) {
      delete amenities[amenityId];
    }
    const amenityList = Object.values(amenities).join(', ');
    if (amenityList.length > 30) {
      $('.amenities h4').text(amenityList.substring(0, 29) + '...');
    } else {
      $('.amenities h4').text(amenityList);
    }
    if ($.isEmptyObject(amenities)) {
      $('.amenities h4').html('&nbsp;');
    }
  });
});
