VDL Plugin SDK

getOptionString

Import from @varavel/vdl-plugin-sdk/utils/options.

function getOptionString(
   options, 
   key, 
   defaultValue
): string;

Returns a string option or the provided fallback when the key is missing.

Unlike the numeric and enum helpers, this function preserves the raw option value exactly as provided, including empty strings.

Parameters

ParameterTypeDescription
optionsRecord<string, string> | undefinedPlugin options record.
keystringOption name to read.
defaultValuestringValue returned when the option is missing.

Returns

string

The raw option string, or the default when the key is missing.

Example

getOptionString({ prefix: "Api" }, "prefix", "Model");
// returns "Api"