estools/estraverse

estraverse::nodeToObject

a-x- opened this issue · 0 comments

a-x- commented

What about nodeToObject method?
now I have to use workaroud with patched escodegen and json.parse:

const nodeToObject = node => JSON.parse(codegen.generate(node, {format: {realjson: true}}));

usage

traverse.traverse(ast, {
    enter: node => isBemjson(node) && bemjsons.push(this.nodeToObject(node))
});