Sorts data for displaying vertical columns when the browser floats them horizontally.
const vfc = require('vertical-flow-columns');
const data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
0
1
2
3
4
5
6
7
8
9
var sorted = vfc(data, 2);
=> [ 0, 5, 1, 6, 2, 7, 3, 8, 4, 9 ]
0 5
1 6
2 7
3 8
4 9
var sorted = vfc(data, 3);
=> [ 0, 4, 7, 1, 5, 8, 2, 6, 9, 3 ]
0 4 7
1 5 8
2 6 9
3
var sorted = vfc(data, 4);
=> [ 0, 3, 6, 8, 1, 4, 7, 9, 2, 5 ]
0 3 6 8
1 4 7 9
2 5
Sorts data for displaying vertical columns when the browser floats them horizontally.
Param | Type | Default | Description |
---|---|---|---|
data | Array |
The data to be sorted as columns. | |
[n] | Integer |
2 |
The number of columns. |