2 [![npm version](https://badge.fury.io/js/escodegen.svg)](http://badge.fury.io/js/escodegen)
3 [![Build Status](https://secure.travis-ci.org/estools/escodegen.svg)](http://travis-ci.org/estools/escodegen)
4 [![Dependency Status](https://david-dm.org/estools/escodegen.svg)](https://david-dm.org/estools/escodegen)
5 [![devDependency Status](https://david-dm.org/estools/escodegen/dev-status.svg)](https://david-dm.org/estools/escodegen#info=devDependencies)
7 Escodegen ([escodegen](http://github.com/estools/escodegen)) is an
8 [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
9 (also popularly known as [JavaScript](http://en.wikipedia.org/wiki/JavaScript))
10 code generator from [Mozilla's Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)
11 AST. See the [online generator](https://estools.github.io/escodegen/demo/index.html)
17 Escodegen can be used in a web browser:
19 <script src="escodegen.browser.js"></script>
21 escodegen.browser.js can be found in tagged revisions on GitHub.
23 Or in a Node.js application via npm:
29 A simple example: the program
32 type: 'BinaryExpression',
34 left: { type: 'Literal', value: 40 },
35 right: { type: 'Literal', value: 2 }
38 produces the string `'40 + 2'`.
40 See the [API page](https://github.com/estools/escodegen/wiki/API) for
41 options. To run the tests, execute `npm test` in the root directory.
43 ### Building browser bundle / minified browser bundle
45 At first, execute `npm install` to install the all dev dependencies.
50 will generate `escodegen.browser.js`, which can be used in browser environments.
54 npm run-script build-min
56 will generate the minified file `escodegen.browser.min.js`.
62 Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)
63 (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
65 Redistribution and use in source and binary forms, with or without
66 modification, are permitted provided that the following conditions are met:
68 * Redistributions of source code must retain the above copyright
69 notice, this list of conditions and the following disclaimer.
71 * Redistributions in binary form must reproduce the above copyright
72 notice, this list of conditions and the following disclaimer in the
73 documentation and/or other materials provided with the distribution.
75 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
76 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
77 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
78 ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
79 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
80 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
81 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
82 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
83 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
84 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
88 SourceNodeMocks has a limited interface of mozilla/source-map SourceNode implementations.
90 Copyright (c) 2009-2011, Mozilla Foundation and contributors
93 Redistribution and use in source and binary forms, with or without
94 modification, are permitted provided that the following conditions are met:
96 * Redistributions of source code must retain the above copyright notice, this
97 list of conditions and the following disclaimer.
99 * Redistributions in binary form must reproduce the above copyright notice,
100 this list of conditions and the following disclaimer in the documentation
101 and/or other materials provided with the distribution.
103 * Neither the names of the Mozilla Foundation nor the names of project
104 contributors may be used to endorse or promote products derived from this
105 software without specific prior written permission.
107 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
108 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
109 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
110 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
111 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
112 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
113 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
114 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
115 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
116 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.