escodegen
escodegen copied to clipboard
ECMAScript code generator
Quite often I see minified code that puts individual statements at the global level on different lines. For example: ``` function a() { ... } function b() { ... function...
```js const {a=1, b=2} = {a:2}; ``` To esprima ([link](http://esprima.org/demo/parse.html?code=const%20%7Ba%3D1%2C%20b%3D2%7D%20%3D%20%7Ba%3A2%7D%3B)) returns the correct AST. Back to JS through escodegen: ``` const {a, b} = { a: 2 }; ``` Which...
Hey, Can you guys release a version with the create regexp fix? https://github.com/estools/escodegen/commit/719de3033c4a9a0df27f698c47b48d2af7241835 Thanks
```js const {generate} = require('escodegen'); const {parse} = require('esprima'); generate(parse('const {foo: bar = baz} = quux')) === `const { bar = baz: bar = baz } = quux;` ```
I see in the Wiki at https://github.com/estools/escodegen/wiki/Source-Map-Usage an example with Esprima, but it doesn't include a transform step: ```js var ast = esprima.parse('var a = 1', { loc: true, source:...
This would allow `escodegen` to drop `optionator` and its sub-dependencies, reducing the number of dependencies for packages that depend on `escodegen` but not it's CLI, (i.e. `jsdom`, `istanbul`, `isparta`).
This script _should_ produce functionally-identical JS as output: ``` js const js = ` var example = function() { return /*@ngInject*/ function($scope) { return $scope; }; }; `; const ast...
According to this request - https://github.com/estools/escodegen/pull/299 I added the needed tests, Updated the package.json dependecies to the latest versions. We still need that the traverse labrary owneres will add this...
get rewritten into ``` javascript [ 1, 2 ] ``` which is not what one would expect rewriting the code. That's a small, innocent literal array. And yet I see...