* Destructure object. * @param {string[]} items items * @param {string} value value * @returns {string} destructure object code
(items, value)
| 471 | * @returns {string} destructure object code |
| 472 | */ |
| 473 | destructureObject(items, value) { |
| 474 | const decl = this.renderLet(); |
| 475 | return this.supportsDestructuring() |
| 476 | ? `${decl} {${items.join(", ")}} = ${value};` |
| 477 | : Template.asString( |
| 478 | items.map( |
| 479 | (item) => `${decl} ${item} = ${value}${propertyAccess([item])};` |
| 480 | ) |
| 481 | ); |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Returns iIFE code. |
no test coverage detected