mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-11 16:10:05 +00:00
Checkout on credit add (#3555)
This commit is contained in:
@@ -415,3 +415,17 @@ export function compareVersions(
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a USD amount to microdollars (1/1,000,000 of a dollar).
|
||||
* This conversion is commonly used in financial systems to avoid floating-point precision issues
|
||||
* by representing monetary values as integers.
|
||||
*
|
||||
* @param usd - The amount in US dollars to convert
|
||||
* @returns The amount in microdollars (multiplied by 1,000,000)
|
||||
* @example
|
||||
* usdToMicros(1.23) // returns 1230000
|
||||
*/
|
||||
export function usdToMicros(usd: number): number {
|
||||
return Math.round(usd * 1_000_000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user