Skip to content

Commit

Permalink
fix(diagnostic): handle zero-length recursives properly in diag output
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jan 17, 2022
1 parent d46fae2 commit 38ec7ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/diagnostic.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ function * tokensToDiagnostic (inp, width = 100) {
if (!token.type.terminal) {
switch (token.type.name) {
case 'map':
indent.push(token.value * 2)
if (token.value) {
indent.push(token.value * 2)
}
break
case 'array':
indent.push(token.value)
if (token.value) {
indent.push(token.value)
}
break
// TODO: test tags .. somehow
/* c8 ignore next 5 */
Expand Down

0 comments on commit 38ec7ea

Please sign in to comment.