Publish your own packages to the world's most popular software ecosystem with npm Pro.Get started »

@pelevesque/matrix-transformers

0.0.4 • Public • Published

Build Status Coverage Status JavaScript Style Guide

matrix-transformers

A collection of matrix transformation algorithms.

Node Repository

https://www.npmjs.com/package/@pelevesque/matrix-transformers

Installation

npm install @pelevesque/matrix-transformers

Tests

Standard Style & Unit Tests

npm test

Unit Tests & Coverage

npm run cover

Usage

Requiring the Module

const matrixTransformers = require('@pelevesque/matrix-transformers')

Requiring a Particular Transformation

const rotateMatrixClockwise = require('@pelevesque/matrix-transformers').rotate90

Available Transformations

  • rotate90
  • rotate180
  • rotate270
  • reflectHorizontally
  • reflectVertically

Examples

const matrix = [
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9]
]
const transformed = matrixTransformers.reflectHorizontally(matrix)
 
// result
transformed = [
  [3, 2, 1],
  [6, 5, 4],
  [9, 8, 7]
]
const matrix = [
  [1, 2],
  [3, 4],
  [5, 6]
]
const transformed = matrixTransformers.rotate270(matrix)
 
// result
transformed = [
  [2, 4, 6],
  [1, 3, 5]
]

Install

npm i @pelevesque/matrix-transformers

DownloadsWeekly Downloads

4

Version

0.0.4

License

MIT

Unpacked Size

9.63 kB

Total Files

6

Last publish

Collaborators

  • avatar