MCPcopy Create free account
hub / github.com/SmartThingsCommunity/smartthings-cli / valueOfChoice

Function valueOfChoice

src/lib/item-input/select.ts:49–50  ·  view source on GitHub ↗
(choice: SelectDefChoice<T>)

Source from the content-addressed store, hash-verified

47 const nameOfChoice = (choice: SelectDefChoice<T>): string =>
48 typeof choice === 'object' ? choice.name : choice.toString()
49 const valueOfChoice = (choice: SelectDefChoice<T>): T =>
50 (typeof choice === 'number' || typeof choice === 'string' ? choice : choice.value) as T
51
52 const namesByValue = new Map(choices.map(choice => [valueOfChoice(choice), nameOfChoice(choice)]))
53

Callers 2

selectDefFunction · 0.85
editValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected