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

Function resolveDropdownLabel

apps/sim/lib/workflows/subblocks/display.ts:352–368  ·  view source on GitHub ↗
(
  subBlock: SubBlockConfig | undefined,
  rawValue: unknown
)

Source from the content-addressed store, hash-verified

350 * Returns null if not a dropdown/combobox or no matching option is found.
351 */
352export function resolveDropdownLabel(
353 subBlock: SubBlockConfig | undefined,
354 rawValue: unknown
355): string | null {
356 if (!subBlock || (subBlock.type !== 'dropdown' && subBlock.type !== 'combobox')) return null
357 if (!rawValue || typeof rawValue !== 'string') return null
358
359 const options = typeof subBlock.options === 'function' ? subBlock.options() : subBlock.options
360 if (!options) return null
361
362 const option = options.find((opt) =>
363 typeof opt === 'string' ? opt === rawValue : opt.id === rawValue
364 )
365
366 if (!option) return null
367 return typeof option === 'string' ? option : option.label
368}
369
370/** Resolves a workflow-selector value to the workflow's name. */
371export function resolveWorkflowSelectionLabel(

Callers 3

display.test.tsFile · 0.90
block.tsxFile · 0.90
workflow-block.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected