Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 692 Bytes

File metadata and controls

40 lines (30 loc) · 692 Bytes

You can use this method to transpose 2D array.

Build Status install size

Install

$ npm i transpose-2d-array

Usage

import transpose from "transpose-2d-array"

or

const transpose = require("transpose-2d-array")
const arr = [
  [[1], [2]],
  [[1], [2]],
  [[1], [2]],
  [[1], [2]]
]

const result = transpose(arr)

// result will be
//
// [
//   [[1], [1], [1], [1]],
//   [[2], [2], [2], [2]]
// ]