Catalog npm
PACKAGE EXPLORERView in registry

2dmatrix

npm

Create 2d Matrix

2d matrix
Versions collected2
Direct dependencies6From release 1.0.1
Last observed20 Oct, 19:11 UTC

README

Current package documentation

2DMatrix

A simple yet powerful TypeScript library for generating and displaying 2D matrices with CLI table formatting.

Installation

npm install 2dmatrix

Features

  • Generate random 2D matrices with customizable dimensions and value ranges.
  • Display matrices in a well-formatted CLI table with coordinates.
  • Fully written in TypeScript with type definitions included.

Usage

import mx from "2dmatrix";

mx.openCLI = true; // Enable CLI table display
mx.tableWidth = 20; // Set column width

const createRandomMatrix = mx.randomMx(2, 3, 50);
console.log(createRandomMatrix);

Output Example

╔══════╤══════╤══════╗
║  12  │  34  │  23  ║
║ (1,1)│ (1,2)│ (1,3)║
╟──────┼──────┼──────╢
║  45  │  32  │  11  ║
║ (2,1)│ (2,2)│ (2,3)║
╚══════╧══════╧══════╝

API

randomMx(rows: number, cols: number, range: number): RandomMx

Generates a random matrix with given rows and columns, and fills it with random numbers up to the specified range.

Parameters:

  • rows - Number of rows in the matrix.
  • cols - Number of columns in the matrix.
  • range - Maximum value for random numbers.

Returns:

{
  randomMatrix: number[][];
  coordinates: Coordinate[];
  matrixSize: string;
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Developed by Hamza Atmaca.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 2

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.1Registry latest17 Feb 20256
1.0.017 Feb 20256

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:11 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f33d313636b42f7aeac441ea61deb927aa21757163f4f9c06d2bbcef4c41f056