refactor: add yaml subfield label helper (#365)
Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
@@ -185,6 +185,10 @@ export function yamlFieldLabel(configLabel: string, path: string, key: string):
|
||||
return `${configLabel}.${prefix}${key}`;
|
||||
}
|
||||
|
||||
export function yamlSubFieldLabel(label: string, key: string): string {
|
||||
return label.endsWith(".") ? `${label}${key}` : `${label}.${key}`;
|
||||
}
|
||||
|
||||
export function yamlRecord(value: unknown, label: string): Record<string, unknown> {
|
||||
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`${label} must be a YAML object`);
|
||||
return value as Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user