useful-matrix
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

useful-matrix v1.0.8

Library for easy work with Two-Dimensional Arrays

NPM Version

Usage

Creating new matrix

import { Matrix } from "useful-matrix" 
// for now (v1.0.8) only esm available

const matrixFrom2dArray = new Matrix([
    [1, 2, 3, 4],
    [1, 2, 3, 4],
    [1, 2, 3, 4],
    [1, 2, 3, 4]
])

const matrixFromOptions = new Matrix({
    width: 4,
    height: 4
}) // returns new Matrix([
//     [0, 0, 0, 0],
//     [0, 0, 0, 0],
//     [0, 0, 0, 0],
//     [0, 0, 0, 0]
// ])

Now (v1.0.8) available this methods

  • validX
  • validY
  • validPos
  • validMatrixSource
  • validRow
  • validCol
  • randomX
  • randomY
  • randomPos
  • get
  • getAllCols
  • getRow
  • getCol
  • getItem
  • getAllItems
  • getFirstRow
  • getFirstCol
  • getFirstItem
  • getLastRow
  • getLastCol
  • getLastItem
  • set
  • setAllCols
  • setRow
  • setCol
  • setItem
  • swapRows
  • swapCols
  • swapItems
  • reverseX
  • reverseY
  • reverseXY
  • rotateLeft
  • rotateRight
  • fillAll
  • mapItems

full documentation will soon appear on the website

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.81latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.81
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i useful-matrix

Weekly Downloads

1

Version

1.0.8

License

ISC

Unpacked Size

12.4 kB

Total Files

4

Last publish

Collaborators

  • shark1_11