mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
11 lines
342 B
JavaScript
11 lines
342 B
JavaScript
let count = 0;
|
|
|
|
let withFoo = { get foo() { return count++; } };
|
|
let withBar = { get bar() { return count++; } };
|
|
|
|
let res = { ...withFoo, middle: count, ...withBar };
|
|
|
|
// Without assuming that getters are pure (in this case it isn't),
|
|
// the result should be { foo: 0, middle: 1, bar: 1 }
|
|
expect(res).toEqual({ foo: 0, middle: 0, bar: 1 });
|