JSPM

babel-normalize-comments

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 91
  • Score
    100M100P100Q86330F
  • License MIT

Merge comments together into a normalized string

Package Exports

  • babel-normalize-comments

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-normalize-comments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.