JSPM

@putout/printer

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21732
  • Score
    100M100P100Q143001F
  • License MIT

Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout

Package Exports

  • @putout/printer

Readme

Printer NPM version

EasyPrint prints Babel AST to readable JavaScript.

  • ☝️ Similar to Recast, but simpler and easier in maintenance, since it supports only Babel.
  • ☝️ As opinionated as Prettier, but has more user-friendly output and works directly with AST.
  • ☝️ Like ESLint but without any configuration and plugins 🤷‍, also works directly with Babel AST only.

Install

npm i @putout/printer

API

const {print} = require('@putout/printer');
const {parse} = require('@babel/parser');

const ast = parse('const a = (b, c) => {const d = 5; return a;}');
print(ast);
// returns
`
const a = (b, c) => {
    const d = 5;
    return a;
};
`;

License

MIT