Skip to content

Commit 82713e9

Browse files
committed
Use node toString if id is undefined
1 parent 61baa84 commit 82713e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/search.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function search(root, expression, maxDepth) {
4949
*/
5050

5151
visit(root, HEADING, function (child, index, parent) {
52-
var value = (child.data && child.data.hProperties) ? child.data.hProperties.id : toString(child);
52+
var value = (child.data && child.data.hProperties && child.data.hProperties.id) ?
53+
child.data.hProperties.id :
54+
toString(child);
5355
var id = slugs.slug(value);
5456

5557
if (parent !== root) {

0 commit comments

Comments
 (0)