MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / buildOptimizer

Function buildOptimizer

ses.cjs:6157–6164  ·  view source on GitHub ↗

* buildOptimizer() * Given an array of identifiers, the optimizer returns a `const` declaration * destructuring `this.${name}`. * * @param {Array } constants * @param {string} name

(constants, name)

Source from the content-addressed store, hash-verified

6155 * @param {string} name
6156 */
6157function buildOptimizer(constants, name) {
6158 // No need to build an optimizer when there are no constants.
6159 if( constants.length=== 0) return '';
6160 // Use 'this' to avoid going through the scope proxy, which is unnecessary
6161 // since the optimizer only needs references to the safe global.
6162 // Destructure the constants from the target scope object.
6163 return `const {${arrayJoin(constants,',') }} = this.${name};`;
6164 }
6165
6166/**
6167 * makeEvaluate()

Callers 1

makeEvaluateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected