Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Apr 7, 2022
1 parent c9e114e commit 8c88dd1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/convert.ts
Expand Up @@ -93,7 +93,7 @@ class PreTokens {
this.index--
}

public forEach(callback: (cst: NormalSourceToken) => void) {
public each(callback: (cst: NormalSourceToken) => void) {
let cst
while ((cst = this.consume())) {
callback(cst)
Expand Down Expand Up @@ -396,7 +396,11 @@ function convertDocumentBody(
if (cst) {
return convertContentNode(preTokens, cst, node, ctx, parent, parent)
}
preTokens.forEach((t) => processAnyToken(t, ctx))
const token = preTokens.first()
/* istanbul ignore if */
if (token) {
throw ctx.throwUnexpectedTokenError(token)
}
return null
}

Expand Down Expand Up @@ -1482,7 +1486,7 @@ function convertAnchorAndTag<V extends YAMLContent>(
return meta
}

preTokens.forEach((cst) => {
preTokens.each((cst) => {
if (isAnchorCST(cst)) {
const ast = getMetaAst(cst)
const anchor = convertAnchor(cst, ctx, ast, doc)
Expand All @@ -1500,7 +1504,7 @@ function convertAnchorAndTag<V extends YAMLContent>(
throw ctx.throwUnexpectedTokenError(cst)
}
})
return meta || (value as never)
return meta || value!
}

/**
Expand Down

0 comments on commit 8c88dd1

Please sign in to comment.