Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: clampUsd function behavior to match JSDoc
Return 0 immediately for NaN values instead of clamping NaN->0->1,
making the actual behavior consistent with the documented behavior.
  • Loading branch information
christian-byrne committed Dec 9, 2025
commit 2c82eb15343f85806d317ff82d2bc7fad602ec80
4 changes: 2 additions & 2 deletions src/base/credits/comfyCredits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ export const formatUsdFromCents = ({
* @returns The clamped value between $1 and $1000, or 0 if NaN
*/
export const clampUsd = (value: number): number => {
const safe = Number.isNaN(value) ? 0 : value
return Math.min(1000, Math.max(1, safe))
if (Number.isNaN(value)) return 0
return Math.min(1000, Math.max(1, value))
}