https://github.com/rebeccastevens/transpose-array
Perform the matrix operation transpose on an array respecting type information.
https://github.com/rebeccastevens/transpose-array
Last synced: about 2 months ago
JSON representation
Perform the matrix operation transpose on an array respecting type information.
- Host: GitHub
- URL: https://github.com/rebeccastevens/transpose-array
- Owner: RebeccaStevens
- License: bsd-3-clause
- Created: 2022-11-03T11:33:20.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-02T19:22:00.000Z (2 months ago)
- Last Synced: 2025-04-02T20:29:15.186Z (2 months ago)
- Language: TypeScript
- Size: 1.41 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# transpose-array
[](https://www.npmjs.com/package/transpose-array)
[](https://deno.land/x/transposearray)
[](https://github.com/RebeccaStevens/transpose-array/actions/workflows/ci.yml)
[](https://codecov.io/gh/RebeccaStevens/transpose-array)\
[](https://github.com/prettier/prettier)
[](https://github.com/RebeccaStevens/transpose-array/discussions)
[](https://opensource.org/licenses/BSD-3-Clause)
[](https://commitizen.github.io/cz-cli/)
[](https://github.com/semantic-release/semantic-release)Perform the [transpose](https://en.wikipedia.org/wiki/Transpose) matrix operation on an array respecting type information.
## Donate
[Any donations would be much appreciated](./DONATIONS.md). 😄
## Installation
### Node
```sh
# Install with npm
npm install transpose-array# Install with pnpm
pnpm add transpose-array# Install with yarn
yarn add transpose-array
```### Deno
```jsonc
// import_map.json
{
"imports": {
"transpose-array": "https://deno.land/x/transposearray@__version__/dist/deno/index.ts"
}
}
```## Usage
```ts
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.