UNPKG

@alu0101337760/constant-folding

Version:
421 lines (163 loc) 7.81 kB
<!doctype html> <html lang="en"> <head> <meta charset='utf-8'> <title>@alu0101337760/constant-folding 1.1.6 | Documentation</title> <meta name='description' content='Constant Folding javascript code'> <meta name='viewport' content='width=device-width,initial-scale=1'> <link href='assets/bass.css' rel='stylesheet'> <link href='assets/style.css' rel='stylesheet'> <link href='assets/github.css' rel='stylesheet'> <link href='assets/split.css' rel='stylesheet'> </head> <body class='documentation m0'> <div class='flex'> <div id='split-left' class='overflow-auto fs0 height-viewport-100'> <div class='py1 px2'> <h3 class='mb0 no-anchor'>@alu0101337760/constant-folding</h3> <div class='mb1'><code>1.1.6</code></div> <input placeholder='Filter' id='filter-input' class='col12 block input' spellcheck='false' autocapitalize='off' autocorrect='off' type='text' /> <div id='toc'> <ul class='list-reset h5 py1-ul'> <li><a href='#constantfolding' class=""> constantFolding </a> </li> <li><a href='#replaceexpression' class=""> replaceExpression </a> </li> <li><a href='#replaceliteralasindex' class=""> replaceLiteralAsIndex </a> </li> <li><a href='#replacelength' class=""> replaceLength </a> </li> <li><a href='#replacebyliteral' class=""> replaceByLiteral </a> </li> </ul> </div> <div class='mt1 h6 quiet'> <a href='https://documentation.js.org/reading-documentation.html'>Need help reading this?</a> </div> </div> </div> <div id='split-right' class='relative overflow-auto height-viewport-100'> <section class='p2 mb2 clearfix bg-white minishadow'> <div class='clearfix'> <h3 class='fl m0' id='constantfolding'> constantFolding </h3> </div> <p>A function that takes a js code as argument and returns the same version after applying constant folding.</p> <div class='pre p1 fill-light mt0'>constantFolding(code: <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>): <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></div> <div class='py1 quiet mt1 prose-big'>Parameters</div> <div class='prose'> <div class='space-bottom0'> <div> <span class='code bold'>code</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a>)</code> A string with the input code. </div> </div> </div> <div class='py1 quiet mt1 prose-big'>Returns</div> <code><a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code>: Returns the equivalent code after applying constant folding. </section> <section class='p2 mb2 clearfix bg-white minishadow'> <div class='clearfix'> <h3 class='fl m0' id='replaceexpression'> replaceExpression </h3> </div> <p>This function replaces the input node by its equivalent after applying constant folding</p> <div class='pre p1 fill-light mt0'>replaceExpression(n: <a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</div> <div class='py1 quiet mt1 prose-big'>Parameters</div> <div class='prose'> <div class='space-bottom0'> <div> <span class='code bold'>n</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</code> </div> </div> </div> </section> <section class='p2 mb2 clearfix bg-white minishadow'> <div class='clearfix'> <h3 class='fl m0' id='replaceliteralasindex'> replaceLiteralAsIndex </h3> </div> <p>This function replaces expressions of the type [1,2,3][2-1]</p> <div class='pre p1 fill-light mt0'>replaceLiteralAsIndex(node: <a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</div> <div class='py1 quiet mt1 prose-big'>Parameters</div> <div class='prose'> <div class='space-bottom0'> <div> <span class='code bold'>node</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</code> </div> </div> </div> </section> <section class='p2 mb2 clearfix bg-white minishadow'> <div class='clearfix'> <h3 class='fl m0' id='replacelength'> replaceLength </h3> </div> <p>This function replaces expressions of the type [1,2,3].length</p> <div class='pre p1 fill-light mt0'>replaceLength(node: <a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</div> <div class='py1 quiet mt1 prose-big'>Parameters</div> <div class='prose'> <div class='space-bottom0'> <div> <span class='code bold'>node</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</code> </div> </div> </div> </section> <section class='p2 mb2 clearfix bg-white minishadow'> <div class='clearfix'> <h3 class='fl m0' id='replacebyliteral'> replaceByLiteral </h3> </div> <p>This function replaces this node contents with the reusult of running its operation with its left and right.</p> <div class='pre p1 fill-light mt0'>replaceByLiteral(node: <a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</div> <div class='py1 quiet mt1 prose-big'>Parameters</div> <div class='prose'> <div class='space-bottom0'> <div> <span class='code bold'>node</span> <code class='quiet'>(<a href="https://developer.mozilla.org/docs/Web/API/Node/nextSibling">Node</a>)</code> </div> </div> </div> </section> </div> </div> <script src='assets/anchor.js'></script> <script src='assets/split.js'></script> <script src='assets/site.js'></script> </body> </html>