{"size": 376, "ext": "js", "max_stars_repo_path": "helpers/coins.js", "max_stars_repo_name": "rediche/gw2-stream", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "helpers/coins.js", "max_issues_repo_name": "rediche/gw2-stream", "max_issues_repo_issues_event_min_datetime": "2019-07-14T18:40:38.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-22T08:09:01.000Z", "max_forks_repo_path": "helpers/coins.js", "max_forks_repo_name": "rediche/gw2-stream", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 28.9230769231, "max_line_length": 57, "alphanum_fraction": 0.6622340426}
/**
 * Convert a number to a string like `1g 2s 3c`
 * @param {Number} coins Coins to be converted to string.
 */
const convertToCoinString = (coins = 0) => {
  const gold = Math.floor(coins / 10000);
  const silver = Math.floor(coins / 100) % 100;
  const copper = Math.floor(coins % 100);

  return `${gold}g ${silver}s ${copper}c`;
};

module.exports = convertToCoinString;