MCPcopy Index your code
hub / github.com/simstudioai/sim / optionalNumber

Function optionalNumber

apps/sim/blocks/blocks/microsoft_excel.ts:44–49  ·  view source on GitHub ↗

Coerces a numeric input value to number, or `undefined` when unset or invalid.

(value: unknown)

Source from the content-addressed store, hash-verified

42
43/** Coerces a numeric input value to number, or `undefined` when unset or invalid. */
44function optionalNumber(value: unknown): number | undefined {
45 const str = optionalString(value)
46 if (str === undefined) return undefined
47 const num = Number(str)
48 return Number.isNaN(num) ? undefined : num
49}
50
51/** Wraps a worksheet name in single quotes when it contains characters that require escaping in an address. */
52function quoteSheetName(sheetName: string): string {

Callers 1

microsoft_excel.tsFile · 0.85

Calls 1

optionalStringFunction · 0.70

Tested by

no test coverage detected