(
value: unknown,
fallback: number,
bounds: { min: number; max: number; integer?: boolean }
)
| 83 | } as const |
| 84 | |
| 85 | function parseBoundedNumber( |
| 86 | value: unknown, |
| 87 | fallback: number, |
| 88 | bounds: { min: number; max: number; integer?: boolean } |
| 89 | ): number { |
| 90 | const parsed = typeof value === 'number' ? value : Number(value) |
| 91 | if (!Number.isFinite(parsed) || parsed <= 0) return fallback |
| 92 | const clamped = Math.min(Math.max(parsed, bounds.min), bounds.max) |
| 93 | return bounds.integer ? Math.round(clamped) : clamped |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Parses a webhook row's providerConfig into a typed subscription config. |
no outgoing calls
no test coverage detected