{"repo":"neefrehman/make-matrix","free":true,"listed":false,"github":"https://github.com/neefrehman/make-matrix","clone":"git clone https://github.com/neefrehman/make-matrix.git","description":"A simple, type-safe way to create multi-dimensional arrays","language":"TypeScript","stars":26,"topics":["matrix","array","math","multidimensional-arrays","typescript","graphics","javascript","matrices","webgl","generator"],"license":"MIT","category":"chat-messaging","readme_excerpt":"A simple, type-safe way to create multi-dimensional arrays Features - 🛸 Easily create multi-dimensional arrays, with as many dimensions as needed - 🎛 Define exact dimensions to create an array of specified size - 🔢 Initialise every point in the array to a custom or self-aware starting value - 📜 Comes with TypeScript definitions and type-safe returns - 🔬 Tiny size, with no external dependencies Installation Install the package from NPM, and import it into your JavaScript or TypeScript file: Usage Create a matrix To create a matrix, pass in an array with the desired dimensions. Initialise the matrix with set values By default each point in the matrix will be initialised to null (so that if reading a point returns undefined , you know that it exists outside the current bounds of the matrix). To fill each point with a custom initial value, pass that value as the function's second parameter, initialValues : Pass a callback for dynamic initial values The initialValues parameter can also be a callback, which you can use to dynamically create items for each position in the matrix. The callback can also accept an argument which will resolve to the current vector co-ordinates at each point in the matrix. This will allow you to populate your matrix in a \"self-aware\" fashion. With TypeScript This package comes with type definitions to provide type-safety when working with the returned arrays. Returned Matrices will be given a specific type dictated by T and the number of dimensions,","default_branch":null,"files":null,"tree":[],"storefront":"/r/neefrehman","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/neefrehman/make-matrix/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}