You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

20 lines
331 B

  1. export function currencyFormat(num) {
  2. let val = num ? num : 0;
  3. return val.toLocaleString('en-US', {
  4. minimumFractionDigits: 2
  5. });
  6. }
  7. export function zeroPad(num, places) {
  8. num = num ? num : 0;
  9. var zero = places - num.toString().length + 1;
  10. return Array(+(zero > 0 && zero)).join("0") + num;
  11. }