Output - gracefully handle empty destructureds
This commit is contained in:
@@ -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[][] => {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user