MCPcopy Create free account
hub / github.com/chhoumann/quickadd / resolveInputType

Function resolveInputType

src/utils/valueSyntax.ts:363–391  ·  view source on GitHub ↗
(
	rawType: string | undefined,
	{
		tokenDisplay,
		hasOptions,
		allowCustomInput,
	}: { tokenDisplay: string; hasOptions: boolean; allowCustomInput: boolean },
	quiet = false,
)

Source from the content-addressed store, hash-verified

361}
362
363function resolveInputType(
364 rawType: string | undefined,
365 {
366 tokenDisplay,
367 hasOptions,
368 allowCustomInput,
369 }: { tokenDisplay: string; hasOptions: boolean; allowCustomInput: boolean },
370 quiet = false,
371): ValueInputType | undefined {
372 if (!rawType) return undefined;
373 const raw = rawType.trim().toLowerCase();
374 // `boolean` is a friendly alias for the checkbox true/false picker.
375 const normalized = (raw === "boolean" ? "checkbox" : raw) as ValueInputType;
376 if (!OPTION_INCOMPATIBLE_TYPES.has(normalized)) {
377 if (!quiet)
378 log.logWarning(
379 `QuickAdd: Unsupported VALUE type "${rawType}" in token "${tokenDisplay}". Supported types: multiline, number, slider, checkbox, text.`,
380 );
381 return undefined;
382 }
383 if (hasOptions || allowCustomInput) {
384 if (!quiet)
385 log.logWarning(
386 `QuickAdd: Ignoring type:${normalized} for option-list VALUE token "${tokenDisplay}".`,
387 );
388 return undefined;
389 }
390 return normalized;
391}
392
393function parseFiniteNumber(value: string | undefined): number | undefined {
394 if (value === undefined) return undefined;

Callers 2

parseValueTokenFunction · 0.85

Calls 1

logWarningMethod · 0.65

Tested by

no test coverage detected