- Notifications
You must be signed in to change notification settings - Fork335
estools/escodegen
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Escodegen (escodegen) is anECMAScript(also popularly known asJavaScript)code generator fromMozilla's Parser APIAST. See theonline generatorfor a demo.
Escodegen can be used in a web browser:
<script src="escodegen.browser.js"></script>escodegen.browser.js can be found in tagged revisions on GitHub.
Or in a Node.js application via npm:
npm install escodegenA simple example: the program
escodegen.generate({ type: 'BinaryExpression', operator: '+', left: { type: 'Literal', value: 40 }, right: { type: 'Literal', value: 2 }});produces the string'40 + 2'.
See theAPI page foroptions. To run the tests, executenpm test in the root directory.
At first, executenpm install to install the all dev dependencies.After that,
npm run-script buildwill generateescodegen.browser.js, which can be used in browser environments.
And,
npm run-script build-minwill generate the minified fileescodegen.browser.min.js.
Copyright (C) 2012Yusuke Suzuki(twitter:@Constellation) and other contributors.
Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyrightnotice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED ANDON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
About
ECMAScript code generator
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.