var changes = {
insert : [[0, 5], [1, 4], [2, 3], [3, 2]],
length : 5,
relocation : []
}
function conversion(b, c) {
for (var a = 0; a < c.relocation.length; a++) {
var d = c.relocation[a];
b = b.splice(d[0], d[1]).concat(b)
}
for (a = 0; a < c.insert.length; a++) d = c.insert[a], b.splice(d[0], 0, d[1]);
b.length = c.length;
return b
};
alert( conversion([1, 2, 3, 4, 5],changes));
alert( conversion([1, 2, 3, 4, 5, 6, 7, 8, 20, 30],changes))