UNPKG

@niweera/node-asterer

Version:

A CLI tool to generate the AST of a given JavaScript File and save it in *.JSON format.

17 lines (14 loc) 303 B
const fs = require("fs"); const saveAST = (output_path, ast_object) => { return new Promise((resolve, reject) => { try { fs.writeFileSync(output_path, JSON.stringify(ast_object, null, 4)); resolve(); } catch (e) { reject(e); } }); }; module.exports = { saveAST, };