gri2d

1.0.0 • Public • Published

Gri2D

This is a small library to work with 2d arrays.

Usage

//Initialize a 12x8 grid filled with 1
var grid = new Gri2D(12,8,1);

//Get the cell value at 5,3 coordinates
grid.set(5,3);

//Set each cell to its index
grid.each(function(el,i,array){
    return i;
  });

Methods

setArray(array,flat,width)

getArray()

set(x,y,value)

get(x,y)

getSize()

getWidth()

getHeight()

find(value)

swap(x1,y1,x2,y2)

isOnEdge(x,y)

isInside(x,y)

isClose(x1,y1,x2,y2,radius)

each(function(element,index,array){})

print()

Readme

Keywords

Package Sidebar

Install

npm i gri2d

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • oignon