(dollars: string | number)
| 21 | } |
| 22 | |
| 23 | export function dollarsToMicros(dollars: string | number): number { |
| 24 | if (typeof dollars === "string" && dollars.trim() === "") { |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | const micros = Math.round(Number(dollars) * MICROS_PER_DOLLAR); |
| 29 | return Number.isFinite(micros) && micros > 0 ? micros : 0; |
| 30 | } |
| 31 | |
| 32 | export function isPositiveFiniteDollarAmount(dollars: string): boolean { |
| 33 | return dollars.trim() !== "" && dollarsToMicros(dollars) > 0; |
no test coverage detected