v1.1.0
Perform the matrix operation transpose on an array respecting type information.
Repository
Current version released
2 years ago
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.