Skip to main content

Function: getTopLevelYamlKeyValue()

getTopLevelYamlKeyValue(yamlSource: string, key: string): string | null

Defined in: _internal/config-file-scanner.ts:115

Finds the scalar value of a root-level YAML mapping key (key: value).

Only matches lines at indentation level 0 that are not blank or comments. Strips surrounding single/double quotes from the returned value so callers receive a normalised string regardless of whether the YAML author quoted it.

Returns null when the key is absent. Returns an empty string when the key is present but has no value (key:).

Parameters​

yamlSource​

string

key​

string

Returns​

string | null