I have json objects stored in a javascript Map. These items are ordered in according to how they were added to the Map.
var rows = new Map();
rows.set(1, A);
rows.set(3, B);
rows.set(4, C);
rows.set(7, D);
// A, B, C, D
Now I would like to move an object up or down one position, is there a way to do this.
rows.swap(1, 3);
// B, A, C, D