pop-zip
Version:
Zip and unzip, also called matrix transpose
40 lines (38 loc) • 675 B
JavaScript
;
module.exports = {
'common case': {
input: [
['a', 'b', 'c'],
[1, 2, 3],
['x', 'y', 'z']
],
output: [
['a', 1, 'x'],
['b', 2, 'y'],
['c', 3, 'z']
]
},
'one short row': {
input: [
['a', 'b', 'c'],
[1, 2]
],
output: [
['a', 1],
['b', 2]
]
},
'one empty row': {
input: [
['a', 'b', 'c'],
[1, 2, 3],
[]
],
output: [
]
},
'degenerate': {
input: [],
output: []
}
};