We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44e794d commit ba3597bCopy full SHA for ba3597b
index.js
@@ -25,7 +25,7 @@ export function toString(node, separator = '') {
25
if (typeof node.value === 'string') return node.value
26
27
// @ts-ignore Looks like a list of nodes or parent.
28
- children = 'length' in node ? node : node.children
+ children = ('length' in node ? node : node.children) || []
29
30
// Shortcut: This is pretty common, and a small performance win.
31
if (children.length === 1 && 'value' in children[0]) {
test.js
@@ -50,5 +50,7 @@ test('toString()', function (t) {
50
'should support separators'
51
)
52
53
+ t.equal(toString(u('foo')), '', 'should support voids')
54
+
55
t.end()
56
})
0 commit comments