Debian Codegraph @

packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-rest/variable-exec/exec.js

raw
1 // var { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
2
3 // expect(x).toBe(1);
4 // expect(y).toBe(2);
5 // expect(z).toEqual({ a: 3, b: 4 });
6
7 // var complex = {
8 // x: { a: 1, b: 2, c: 3 },
9 // };
10
11 // var {
12 // x: { a: xa, ...xbc }
13 // } = complex;
14
15 // expect(xa).toBe(1);
16 // expect(xbc).toEqual({ b: 2, c: 3});
17
18 // // own properties
19 // function ownX({ ...properties }) {
20 // return properties.x;
21 // }
22 // expect(ownX(Object.create({ x: 1 }))).toBeUndefined();