Skip to content

hughsk/multiline-ast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published