import { helper } from 'ember-helper';

/*
  Simple helper to that takes a dollar amount and cuts out the cents, then
  inserts commas at the appropriate places
*/

export function floatToDollars(revenue) {
  return Math.floor(revenue).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

export default helper(floatToDollars);
