Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function toString(node, separator = '') {
if (typeof node.value === 'string') return node.value

// @ts-ignore Looks like a list of nodes or parent.
children = 'length' in node ? node : node.children
children = ('length' in node ? node : node.children) || []

// Shortcut: This is pretty common, and a small performance win.
if (children.length === 1 && 'value' in children[0]) {
Expand Down
2 changes: 2 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ test('toString()', function (t) {
'should support separators'
)

t.equal(toString(u('foo')), '', 'should support voids')

t.end()
})