MCPcopy
hub / github.com/webpack/webpack / destructureArray

Method destructureArray

lib/RuntimeTemplate.js:458–465  ·  view source on GitHub ↗

* Returns destructure array code. * @param {string[]} items items * @param {string} value value * @returns {string} destructure array code

(items, value)

Source from the content-addressed store, hash-verified

456 * @returns {string} destructure array code
457 */
458 destructureArray(items, value) {
459 const decl = this.renderLet();
460 return this.supportsDestructuring()
461 ? `${decl} [${items.join(", ")}] = ${value};`
462 : Template.asString(
463 items.map((item, i) => `${decl} ${item} = ${value}[${i}];`)
464 );
465 }
466
467 /**
468 * Destructure object.

Callers 3

generateMethod · 0.80
generateMethod · 0.80
generateMethod · 0.80

Calls 3

renderLetMethod · 0.95
supportsDestructuringMethod · 0.95
asStringMethod · 0.45

Tested by

no test coverage detected