Skip to content

Perform the matrix operation transpose on an array respecting type information.

License

Notifications You must be signed in to change notification settings

RebeccaStevens/transpose-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transpose-array

npm version deno version CI Coverage Status
code style: prettier GitHub Discussions BSD 3 Clause license Commitizen friendly semantic-release

Perform the transpose matrix operation on an array respecting type information.

Donate

Any donations would be much appreciated. 😄

Installation

Node

# Install with npm
npm install transpose-array

# Install with pnpm
pnpm add transpose-array

# Install with yarn
yarn add transpose-array

Deno

// import_map.json
{
  "imports": {
    "transpose-array": "https://deno.land/x/transposearray@__version__/dist/deno/index.ts"
  }
}

Usage

import transpose from "transpose-array";

const data = [
  ['a', 'b', 'c', 'd'],
  ['e', 'f', 'g', 'h'],
  ['i', 'j', 'k', 'l'],
]

const transposedData = transpose(data);
// => [
//   ['a', 'e', 'i'],
//   ['b', 'f', 'j'],
//   ['c', 'g', 'k'],
//   ['d', 'h', 'l'],
// ]

API

transpose(array) [default]

Create a new array which is a transposed version of the given array.

transposeInPlace(array)

Modifies the given array in order to transpose it.

About

Perform the matrix operation transpose on an array respecting type information.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •