(value: unknown)
| 42 | |
| 43 | // Parse a possibly-bigint-as-string value (Postgres/ClickHouse return UInt64/bigint as strings in JSON). |
| 44 | function toNumberOrNull(value: unknown): number | null { |
| 45 | if (value === null || value === undefined) { |
| 46 | return null; |
| 47 | } |
| 48 | const parsed: number = Number(value); |
| 49 | return isNaN(parsed) ? null : parsed; |
| 50 | } |
| 51 | |
| 52 | /* |
| 53 | * Normalise a timestamp to an ISO string for the JSON bundle. Accepts Date |
no outgoing calls
no test coverage detected