sort-into-columns
v1.0.0
Published
Sort an array so that it'll display in columns when output inline.
Downloads
177
Readme
Sort an array so that it'll display in columns when output inline.
var originalOrder = [0, 1, 2, 3, 4, 5, 6, 7];
sortIntoColumns(originalOrder, 3);
// [
// 0, 3, 6,
// 1, 4, 7,
// 2, 5
// ]
sortIntoColumns(originalOrder, 2);
// [
// 0, 4,
// 1, 5,
// 2, 6,
// 3, 7
// ]