Escodegen——模具行业从业者必备知识手册
-
<h3>Escodegen</h3>
<p><a href="upload://9qprTbrCgkp6CeTtXNjypHmo7XL.svg"><img src="http://badge.fury.io/js/escodegen" alt="npm version</a>"></p>
<p><a href="https://secure.travis-ci.org/estools/escodegen.svg"><img src="http://travis-ci.org/estools/escodegen" alt="Build Status</a>"></p>
<p><a href="https://david-dm.org/estools/escodegen.svg"><img src="https://david-dm.org/estools/escodegen" alt="Dependency Status</a>"></p>
<p><a href="https://david-dm.org/estools/escodegen/dev-status.svg"><img src="https://david-dm.org/estools/escodegen#info=devDependencies" alt="devDependency Status</a>"></p><p>Escodegen (<a href="http://github.com/estools/escodegen">escodegen</a>) is an</p>
<p><a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript</a></p>
<p>(also popularly known as <a href="http://en.wikipedia.org/wiki/JavaScript">JavaScript</a>)</p>
<p>code generator from <a href="https://developer.mozilla.org/en/SpiderMonkey/Parser_API">Mozilla's Parser API</a></p>
<p>AST. See the <a href="https://estools.github.io/escodegen/demo/index.html">online generator</a></p>
<p>for a demo.</p><h4>Install</h4>
<p>Escodegen can be used in a web browser:</p>
<p> <script src="escodegen.browser.js"></script></p>
<p>escodegen.browser.js can be found in tagged revisions on GitHub.</p>
<p>Or in a Node.js application via npm:</p>
<p> npm install escodegen</p>
<h4>Usage</h4>
<p>A simple example: the program</p>
<p> escodegen.generate({</p>
<p> type: 'BinaryExpression',</p>
<p> operator: '+',</p>
<p> left: { type: 'Literal', value: 40 },</p>
<p> right: { type: 'Literal', value: 2 }</p>
<p> });</p><p>produces the string <code>'40 + 2'</code>.</p>
<p>See the <a href="https://github.com/estools/escodegen/wiki/API">API page</a> for</p>
<p>options. To run the tests, execute <code>npm test</code> in the root directory.</p><h4>Building browser bundle / minified browser bundle</h4>
<p>At first, execute <code>npm install</code> to install the all dev dependencies.</p>
<p>After that,</p><p> npm run-script build</p>
<p>will generate <code>escodegen.browser.js</code>, which can be used in browser environments.</p>
<p>And,</p>
<p> npm run-script build-min</p>
<p>will generate the minified file <code>escodegen.browser.min.js</code>.</p>
<h4>License</h4>
<p>#### Escodegen</p>
<p>Copyright (C) 2012 <a href="http://github.com/Constellation">Yusuke Suzuki</a></p>
<p> (twitter: <a href="http://twitter.com/Constellation">@Constellation</a>) and other contributors.</p><p>Redistribution and use in source and binary forms, with or without</p>
<p>modification, are permitted provided that the following conditions are met:</p><ul>
<li>Redistributions of source code must retain the above copyright</li>
</ul>
<p> notice, this list of conditions and the following disclaimer.</p><ul>
<li>Redistributions in binary form must reproduce the above copyright</li>
</ul>
<p> notice, this list of conditions and the following disclaimer in the</p>
<p> documentation and/or other materials provided with the distribution.</p><p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</p>
<p>AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</p>
<p>IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</p>
<p>ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY</p>
<p>DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</p>
<p>(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</p>
<p>LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</p>
<p>ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</p>
<p>(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF</p>
<p>THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p><hr>
<p>本文由模极社发布</p>
<h4>
内容概览</h4><table>
<tr><td>分类</td><td>要点</td><td>建议/说明</td></tr>
<tr><td>核心概念</td><td>Escodegen</td><td>详见正文</td></tr>
<tr><td>操作步骤</td><td>Escodegen</td><td>详见正文</td></tr>
<tr><td>注意事项</td><td>Escodegen</td><td>详见正文</td></tr>
<tr><td>适用场景</td><td>Escodegen</td><td>详见正文</td></tr>
<tr><td>常见问题</td><td>Escodegen</td><td>详见正文</td></tr>
</table><hr>
<p>###</p><hr>
<p>各位师傅觉得这个方案怎么样?有更好的做法吗?</p>