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

Function defaultWithContextFn

src/lib/item-input/misc.ts:36–40  ·  view source on GitHub ↗
(
	def?: InputDefinitionDefaultValueOrFn<T>,
	context?: unknown[],
)

Source from the content-addressed store, hash-verified

34 : undefined
35
36export const defaultWithContextFn = <T extends string | number>(
37 def?: InputDefinitionDefaultValueOrFn<T>,
38 context?: unknown[],
39): DefaultValueOrFn<T> | undefined =>
40 typeof def === 'function' ? () => def(context) : def
41
42export type StringDefOptions = Omit<OptionalStringInputOptions, 'default' | 'validate'> & {
43 default?: InputDefinitionDefaultValueOrFn<string>

Callers 2

buildFromUserInputFunction · 0.85
misc.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected