Output - gracefully handle empty destructureds

This commit is contained in:
2026-09-15 15:08:14 -05:00
parent e728c3fdfa
commit 24815d586e
2 changed files with 3 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ export const isStrDestructuredTable = (what: StrRVal): what is StrDestructuredTa
item.value.term === 'destructured'
&& item.value.value.every(subitem =>
subitem.value.term === 'string' || subitem.value.term === 'int'))
&& what.value.length > 0
}
export const unwrapStrDestructuredTable = (table: StrDestructuredTable): string[][] => {

View File

@@ -42,12 +42,12 @@ export const getSubjectDisplay = (sub: StrRVal, prefix: string = '', firstLinePr
...row,
])
annotatedTable = [
annotatedTable = annotatedTable.length ? [
['', ...annotatedTable[0]
.map((cell, cellIdx) => ansi.blue`${(cellIdx - 1).toString()}`)
.slice(1)],
...annotatedTable,
]
] : []
try {
return table(annotatedTable, config)