export function abbreviateNumber(count = 0, options = {}) {
  if (typeof count === "string") {
    count = parseInt(count);
  }
  if (global.Intl && global.Intl.NumberFormat) {
    let numberFormat = Intl.NumberFormat(options.locale || "en", {
      notation: "compact",
      // compactDisplay: "short",
    });
    return numberFormat.format(count);
  }
  //Comaptibility
  const COUNT_ABBRS = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];
  let { withAbbr = true, decimals = 2 } = options;
  const i = 0 === count ? count : Math.floor(Math.log(count) / Math.log(1000));
  let result = parseFloat((count / Math.pow(1000, i)).toFixed(decimals));
  if (withAbbr) {
    result += `${COUNT_ABBRS[i]}`;
  }
  return result;
}
