UNPKG

@yugu/gogocode

Version:

The simplest tool to parse/transform/generate code on ast

7 lines 288 B
const { constructTree, tokenize } = require('hyntax-yx'); module.exports = (code) => { // const selfClosingTag = code.replace(/{{[^{^}]+}}/g, '').match(/(?<=\<)[a-z|\.|-]+(?=[^><]+\/>)/g) const { tokens } = tokenize(code) const { ast } = constructTree(tokens) return ast }