Skip to content

Is there a way to map returned values to their row/col position? #279

Closed Answered by eemeli
thislooksfun asked this question in Q&A
Discussion options

You must be logged in to vote

The intended way to achieve this would be something like this:

import { LineCounter, parseDocument, visit } from 'yaml'

const lc = new LineCounter()
const doc = parseDocument('...', { lineCounter: lc })
visit(doc, (_key, node, path) => console.log({ path, pos: lc.linePos(node.range[0]) }))
const data = doc.toJS()

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by eemeli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants