* Returns destructure array code. * @param {string[]} items items * @param {string} value value * @returns {string} destructure array code
(items, value)
| 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. |