UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

11 lines (8 loc) 257 B
import { isArray } from './_internals/isArray.js' export function transpose(array){ return array.reduce((acc, el) => { el.forEach((nestedEl, i) => isArray(acc[ i ]) ? acc[ i ].push(nestedEl) : acc.push([ nestedEl ])) return acc }, []) }