{"size": 906, "ext": "js", "max_stars_repo_path": "resources/js/Helpers/util.js", "max_stars_repo_name": "eliaschampi/admin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/js/Helpers/util.js", "max_issues_repo_name": "eliaschampi/admin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "resources/js/Helpers/util.js", "max_forks_repo_name": "eliaschampi/admin", "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": 21.0697674419, "max_line_length": 69, "alphanum_fraction": 0.6037527594}
/**
 * @name utils
 * @author Elias
 */

/**
 * @param {Object} value
 * @returns Boolean
 */
export const objectHasRow = (value) => Object.keys(value).length > 0;

/**
 * @param {Object} value
 * @returns Boolean
 */
export const defined = (value) => typeof value !== "undefined";

/**
 * @param {Blob} value
 * @param {String} name
 * @param {String} ext default .pdf
 * @return Boolean
 */
export const download = (value, name, ext = ".pdf") => {
  const url = window.URL.createObjectURL(new Blob([value]));
  const link = document.createElement("a");
  link.href = url;
  link.setAttribute("download", name + ext);
  document.body.appendChild(link);
  link.click();
};

export const imagePerson = (profile, gender) => {
  let img = "";
  if (profile) {
    img = profile.image;
  } else {
    const t = gender === "M" ? "men" : "women";
    img = `default_${t}.png`;
  }
  return `/default/${img}`;
};
