Narwhals Prolong Mischief

    strict-matrix

    1.0.2 • Public • Published

    strict-matrix

    npm-version npm-downloads

    A module that provides simple 2 dimensional arrays.

    npm install strict-matrix

    How to use

    const StrictMatrix = require('strict-matrix');
    
    let mat = new StrictMatrix(4, 4, 'def'); // sizeX, sizeY, defaultValue (can take a function, it will execute it, the function gets passed with x and y of the construction)
    // It fills with null if no defaultValue provided
    
    mat.set(2, 2, 'value 1 at 2,2'); // Takes x, y, value
    
    mat.set(4, 5, 'hey'); // Matrix out of bounds
    
    mat.get(2, 2); // Takes x, y, in this case outputs "value 1 at 2,2"
    
    mat.get(4, 5); // Matrix out of bounds
    
    mat.getArray(); // Get the array of array equivalent of the matrix

    License

    MIT (SEE LICENSE FILE)

    Install

    npm i strict-matrix

    DownloadsWeekly Downloads

    2

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    8.74 kB

    Total Files

    6

    Last publish

    Collaborators

    • ahoziorce