mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +00:00
LibJS: Use element index as key for array spread in object
This fixes spreading of arrays with holes in object literals where the inserted keys are not consecutive numbers. Fixes #3967.
This commit is contained in:
parent
06a3625545
commit
745ffca580
2 changed files with 6 additions and 1 deletions
|
@ -53,6 +53,11 @@ test("spread array in object literal", () => {
|
|||
testObjStrSpread(obj);
|
||||
});
|
||||
|
||||
test("spread array with holes in object literal", () => {
|
||||
const obj = { ...[, , "a", , , , "b", "c", , "d", , ,] };
|
||||
expect(obj).toEqual({ 2: "a", 6: "b", 7: "c", 9: "d" });
|
||||
});
|
||||
|
||||
test("spread string object in object literal", () => {
|
||||
const obj = { ...String("abcd") };
|
||||
testObjStrSpread(obj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue