multiline-ast

1.0.0 • Public • Published

multiline-ast experimental

Take an esprima AST and convert multiline-style comment functions into strings.

Usage

NPM

multiline(ast)

Pass an esprima-generated ast object to the module to traverse the tree and replace functions in the following style:

var x = function() {/*
  hello world
*/}

With strings, such as this:

var x = '\n  hello world\n'

Note that you must pass the correct options to esprima while parsing to include comment information correctly, i.e.:

var ast = esprima.parse(code, {
    comment: true
  , ast: true
})

License

MIT. See LICENSE.md for details.

Package Sidebar

Install

npm i multiline-ast

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hughsk