8 lines
192 B
JavaScript
8 lines
192 B
JavaScript
const unzip = arr =>
|
|
arr.reduce(
|
|
(acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc),
|
|
Array.from({
|
|
length: Math.max(...arr.map(x => x.length))
|
|
}).map(x => [])
|
|
);
|
|
module.exports = unzip; |