I have a table of objects like this
let coordinates = [
{
x: 0.579685,
y: 0.566285
},
{
x: 1.580644,
y: 0.653808
},
{
x: 5.549772,
y: 5.804705
},
{
x: 0.54706,
y: 4.536875
},
{
x: 5.539847,
y: 3.547974
}
];
I want to merge it like this
let newCoordinates = [
[
{
x: 0.579685,
y: 0.566285
},
{
x: 1.580644,
y: 0.653808
}
],
[
{
x: 5.549772,
y: 5.804705
},
{
x: 0.54706,
y: 4.536875
}
],
[
{
x: 5.539847,
y: 3.547974
}
]
];
Is there an easy way to do this?