1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

LibJS: Allow BigInts as destructuring property names

These are simply treated as their numerical value which means that above
2^32 - 1 they are strings.
This commit is contained in:
davidot 2022-08-20 00:24:30 +02:00 committed by Linus Groh
parent e663504df1
commit fce2b33758
3 changed files with 37 additions and 1 deletions

View file

@ -223,4 +223,11 @@ describe("evaluating", () => {
expect(x).toBe("foo");
expect(a).toBe(o.a);
});
test("can use big int values as number-like properties", () => {
let o = { "99999999999999999": 1 };
let { 123n: a = "foo", 99999999999999999n: b = "bar" } = o;
expect(a).toBe("foo");
expect(b).toBe(1);
});
});