Skip to content

Commit

Permalink
Fix to use a root as result for fromGemtext
Browse files Browse the repository at this point in the history
Closes GH-4.
  • Loading branch information
wooorm committed Aug 23, 2021
1 parent 6b35bd1 commit e39e17c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/from-gemtext.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import {parser} from './parser.js'
/**
* @param {import('./parser.js').Buf} buf
* @param {import('./parser.js').BufferEncoding} [encoding]
* @returns {Node}
* @returns {Root}
*/
export function fromGemtext(buf, encoding) {
return compile(parser()(buf, encoding, true))
}

/**
* @param {Token[]} tokens
* @returns {Node}
* @returns {Root}
*/
// eslint-disable-next-line complexity
function compile(tokens) {
Expand Down Expand Up @@ -162,6 +162,7 @@ function compile(tokens) {
// Else would be only soft EOLs and EOF.
}

// @ts-expect-error: it’s a root.
return stack[0]

/**
Expand Down

0 comments on commit e39e17c

Please sign in to comment.