Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/multiline-ast
Take an esprima AST and convert multiline-style comment functions into strings
https://github.com/hughsk/multiline-ast
Last synced: 8 days ago
JSON representation
Take an esprima AST and convert multiline-style comment functions into strings
- Host: GitHub
- URL: https://github.com/hughsk/multiline-ast
- Owner: hughsk
- License: other
- Created: 2014-06-21T12:07:18.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-21T12:07:21.000Z (over 10 years ago)
- Last Synced: 2024-10-17T16:38:56.748Z (22 days ago)
- Language: JavaScript
- Size: 105 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# multiline-ast [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)
Take an esprima AST and convert
[multiline](http://github.com/sindresorhus/multiline)-style comment functions
into strings.## Usage
[![NPM](https://nodei.co/npm/multiline-ast.png)](https://nodei.co/npm/multiline-ast/)
### multiline(ast)
Pass an esprima-generated `ast` object to the module to traverse the tree and
replace functions in the following style:``` js
var x = function() {/*
hello world
*/}
```With strings, such as this:
``` js
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.:``` js
var ast = esprima.parse(code, {
comment: true
, ast: true
})
```## License
MIT. See [LICENSE.md](http://github.com/hughsk/multiline-ast/blob/master/LICENSE.md) for details.