refactor: add yaml subfield label helper (#365)

Co-authored-by: Codex <codex@noreply.local>
This commit is contained in:
Lyon
2026-06-14 13:04:53 +08:00
committed by GitHub
parent c525bed7f8
commit 2b80832add
2 changed files with 7 additions and 7 deletions
@@ -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>;