Skip to content

Commit

Permalink
fix: allow components not preceded by a comment (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
akirak authored Jul 4, 2024
1 parent 26b1ac7 commit 013d7ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export interface Data {

function getComment(element: Element): string {
// @ts-ignore
const prev = element.siblings[element.siblings.indexOf(element) - 1] as Element
if (prev.type === COMMENT) {
const prev = element.siblings[element.siblings.indexOf(element) - 1] as Element | undefined
if (prev?.type === COMMENT) {
return (prev.children as string).trim()
}
return ''
Expand Down

0 comments on commit 013d7ee

Please sign in to comment.