Discard binding
Scrap useless values when destructuring.
| Type | TC39 | CoreJS | Babel | Civet | JS+ |
|---|---|---|---|---|---|
| Syntax | ✅ Stage 2 View | ✅ View | ❌ | ✅ via Babel |
JS+ TypeScript
const [void, x, void, y, void, z] = [0, 1, 2, 3, 4, 5];
const { z: void, ...obj1 } = { x: 1, y: 2, z: 3 };console.log(obj1); // { x: 1, y: 2 }const [_, x, __, y, ___, z] = [0, 1, 2, 3, 4, 5];
let obj2;({ z: _, ...obj2 } = { x: 1, y: 2, z: 3 });console.log(obj2); // { x: 1, y: 2 }