MCPcopy
hub / github.com/OneUptime/oneuptime / toNumberOrNull

Function toNumberOrNull

App/API/AdminHealth.ts:44–50  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

42
43// Parse a possibly-bigint-as-string value (Postgres/ClickHouse return UInt64/bigint as strings in JSON).
44function 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

Callers 13

getPostgresStatsFunction · 0.70
getClickhouseStatsFunction · 0.70
parseRedisInfoValueFunction · 0.70
parseMigrationTimestampFunction · 0.70
getPostgresSchemaFunction · 0.70
getPostgresDiagnosticsFunction · 0.70
getPostgresClusterHealthFunction · 0.70
getClickhouseDiagnosticsFunction · 0.70
getPostgresLogsFunction · 0.70
getClickhouseLogsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected