Catalog npm
Back to packageRELEASE DETAILS

1.0.1

npm

2dmatrix

Create 2d Matrix

2d matrix
Published17 Feb 2025
Direct dependencies6
Transitive dependenciesNot calculated

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.

Declared dependencies 6

Native requirements
6 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
chalk
Environment
{
  "local_name": "chalk",
  "alias": false,
  "peer_metadata": null
}
^5.4.1runtime
cli-table3
Environment
{
  "local_name": "cli-table3",
  "alias": false,
  "peer_metadata": null
}
^0.6.5runtime
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.13.4development
nodemon
Environment
{
  "local_name": "nodemon",
  "alias": false,
  "peer_metadata": null
}
^3.1.9development
ts-node
Environment
{
  "local_name": "ts-node",
  "alias": false,
  "peer_metadata": null
}
^10.9.2development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.7.3development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-LvQ4Ac00K1hI8nhRt5qLtIt+JAQLXnysHf8YqWeSVNX+JDRPbVjBPQfK+0dvmLs8Bo1ulkzANGIbNNhXoUqrTg==",
  "shasum": "b4fa9f2890a7a373380bb40a0a268a13e2bbe43b",
  "tarball": "https://registry.npmjs.org/2dmatrix/-/2dmatrix-1.0.1.tgz",
  "fileCount": 14,
  "unpackedSize": 9527,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEQCIHHrCGxLzibYQk5XjMI2wqWLMeFTnAJLrm0WEItRBwqaAiBQ/7/T+M9urWKxFYvpZJ/hm261ymRcAEtDXjj/LZFyjw=="
    }
  ]
}

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_version:a304b78fc87e8bee9fbd0e445aaf26f3ccc6f35445de0a7a0c1db5e12b14b33f

Other collected versions

1.0.017 FebView all collected versions →