Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ECMAScript code generator

License

NotificationsYou must be signed in to change notification settings

estools/escodegen

Repository files navigation

npm versionBuild StatusDependency StatusdevDependency Status

Escodegen (escodegen) is anECMAScript(also popularly known asJavaScript)code generator fromMozilla's Parser APIAST. See theonline generatorfor a demo.

Install

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 escodegen

Usage

A 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.

Building browser bundle / minified browser bundle

At first, executenpm install to install the all dev dependencies.After that,

npm run-script build

will generateescodegen.browser.js, which can be used in browser environments.

And,

npm run-script build-min

will generate the minified fileescodegen.browser.min.js.

License

Escodegen

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

Stars

Watchers

Forks

Packages

No packages published

Contributors51


[8]ページ先頭

©2009-2025 Movatter.jp