babel-normalize-comments

1.0.2 • Public • Published

babel-normalize-comments

Merge comments together into a normalized string

Preserves indentation in many different comment styles

Install

yarn add babel-normalize-comments

Usage

const babylon = require('babylon');
const { normalizeComments, normalizeComment } = require('babel-normalize-comments');

let ast = babylon.parse(code);

// normalize an array of comment nodes
normalizeComments(ast.comments);

// normalize a single comment node
normalizeComment(ast.comments[0]);

See test.js for examples of input and output.

Package Sidebar

Install

npm i babel-normalize-comments

Weekly Downloads

313

Version

1.0.2

License

MIT

Unpacked Size

4.13 kB

Total Files

4

Last publish

Collaborators

  • lbatchelor
  • noviny
  • thejameskyle