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.term === 'destructured'
|
||||||
&& item.value.value.every(subitem =>
|
&& item.value.value.every(subitem =>
|
||||||
subitem.value.term === 'string' || subitem.value.term === 'int'))
|
subitem.value.term === 'string' || subitem.value.term === 'int'))
|
||||||
|
&& what.value.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
export const unwrapStrDestructuredTable = (table: StrDestructuredTable): string[][] => {
|
export const unwrapStrDestructuredTable = (table: StrDestructuredTable): string[][] => {
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ export const getSubjectDisplay = (sub: StrRVal, prefix: string = '', firstLinePr
|
|||||||
...row,
|
...row,
|
||||||
])
|
])
|
||||||
|
|
||||||
annotatedTable = [
|
annotatedTable = annotatedTable.length ? [
|
||||||
['', ...annotatedTable[0]
|
['', ...annotatedTable[0]
|
||||||
.map((cell, cellIdx) => ansi.blue`${(cellIdx - 1).toString()}`)
|
.map((cell, cellIdx) => ansi.blue`${(cellIdx - 1).toString()}`)
|
||||||
.slice(1)],
|
.slice(1)],
|
||||||
...annotatedTable,
|
...annotatedTable,
|
||||||
]
|
] : []
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return table(annotatedTable, config)
|
return table(annotatedTable, config)
|
||||||
|
|||||||
Reference in New Issue
Block a user