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

Function optionalString

apps/sim/blocks/blocks/microsoft_excel.ts:28–32  ·  view source on GitHub ↗

Normalizes an empty/whitespace dropdown or input value to `undefined`, otherwise a trimmed string.

(value: unknown)

Source from the content-addressed store, hash-verified

26
27/** Normalizes an empty/whitespace dropdown or input value to `undefined`, otherwise a trimmed string. */
28function optionalString(value: unknown): string | undefined {
29 if (value === undefined || value === null) return undefined
30 const trimmed = String(value).trim()
31 return trimmed.length > 0 ? trimmed : undefined
32}
33
34/** Coerces a 'true'/'false' dropdown value to boolean, or `undefined` when unset. */
35function optionalBoolean(value: unknown): boolean | undefined {

Callers 3

optionalBooleanFunction · 0.70
optionalNumberFunction · 0.70
microsoft_excel.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected