Skip to content

Commit 1ac9a81

Browse files
committed
refactor: remove extra guard against node.children
1 parent 950633e commit 1ac9a81

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/components/github-htmlview.component.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,12 @@ export class GithubHtmlView extends Component {
388388
);
389389
},
390390
details: (node, index, siblings, parent, defaultRenderer) => {
391-
const summaryTagIdx =
392-
(node.children &&
393-
node.children.findIndex(
394-
n => n.type === 'tag' && n.name === 'summary'
395-
)) ||
396-
-1;
391+
const summaryTagIdx = node.children.findIndex(
392+
n => n.type === 'tag' && n.name === 'summary'
393+
);
397394
const summaryTag = node.children[summaryTagIdx];
398395

399-
if (!summaryTag || !summaryTag.children) {
396+
if (!summaryTag) {
400397
// we have a details tag without summary, rollback to default render
401398
return <View>{defaultRenderer(node.children, node)}</View>;
402399
}

0 commit comments

Comments
 (0)