1.0.0 • Published 10 years ago

multiline-ast v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

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.