{"size": 2049, "ext": "js", "max_stars_repo_path": "src/util/displayImage.js", "max_stars_repo_name": "thnamm/ftw-daily-test", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/util/displayImage.js", "max_issues_repo_name": "thnamm/ftw-daily-test", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/util/displayImage.js", "max_forks_repo_name": "thnamm/ftw-daily-test", "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": 46.5681818182, "max_line_length": 115, "alphanum_fraction": 0.589067838}
export const displayMainImage = (mainImage, allImages) => {
  if (mainImage.length === 0) return [];
  else {
    return allImages.filter(img => {
      const checkSameUUID = (ele) => {
        if (typeof ele === "string" && typeof img.id === "object") return img.id.uuid === ele;
        if (typeof ele === "string" && typeof img.id === "string") return img.imageId.uuid === ele;

        if (Object.keys(img).length < 3 || Object.keys(ele).length < 3) return [];

        if (typeof img.id === "string" && typeof ele.id === "string") return img.imageId.uuid === ele.imageId.uuid;
        if (typeof img.id === "object" && typeof ele.id === "object") return img.id.uuid === ele.id.uuid;
        if (typeof img.id === "string" && typeof ele.id === "object") return img.imageId.uuid === ele.id.uuid;
        if (typeof img.id === "object" && typeof ele.id === "string") return img.id.uuid === ele.imageId.uuid;
      }

      const neededImage = mainImage.find(checkSameUUID);
      return !!neededImage;
    })
  }
}

export const displayOtherImage = (mainImage, allImages) => {
  if (mainImage.length === 0) return allImages;
  else {
    return allImages.filter(img => {
      const checkSameUUID = (ele) => {
        if (typeof ele === "string" && typeof img.id === "object") return img.id.uuid === ele;
        if (typeof ele === "string" && typeof img.id === "string") return img.imageId.uuid === ele;

        if (Object.keys(img).length < 3 || Object.keys(ele).length < 3) return undefined;

        if (typeof img.id === "string" && typeof ele.id === "string") return img.imageId.uuid === ele.imageId.uuid;
        if (typeof img.id === "object" && typeof ele.id === "object") return img.id.uuid === ele.id.uuid;
        if (typeof img.id === "string" && typeof ele.id === "object") return img.imageId.uuid === ele.id.uuid;
        if (typeof img.id === "object" && typeof ele.id === "string") return img.id.uuid === ele.imageId.uuid;
      }

      const neededImage = mainImage.find(checkSameUUID);
      return !neededImage;
    })
  }
}
