MCPcopy
hub / github.com/simstudioai/sim / toDecimal

Function toDecimal

apps/sim/lib/billing/utils/decimal.ts:13–18  ·  view source on GitHub ↗
(value: string | number | null | undefined)

Source from the content-addressed store, hash-verified

11 * Handles null, undefined, empty strings, and number/string inputs.
12 */
13export function toDecimal(value: string | number | null | undefined): Decimal {
14 if (value === null || value === undefined || value === '') {
15 return new Decimal(0)
16 }
17 return new Decimal(value)
18}
19
20/**
21 * Convert Decimal back to number for storage/API responses.

Calls

no outgoing calls

Tested by

no test coverage detected