0.1.1 • Published 7 years ago

bearded-2d v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

#Bearded 2 Dimensional Arrays

If you can understand how to deal with it, it becomes just another data type

Installing:

$ yarn add bearded-2d

And then somewhere in your code:

import Grid from 'bearded-2d'

const grid = new Grid([
    [1,2,3],
    [4,5,6],
    [7,8,9]
])

##API

MethodArgumentsReturns
rowsnulltwo-dimensional array
columnsnulltwo-dimensional array
valuenulltwo-dimensional array
mapfn: Functionnew Grid
containsval: anyBoolean
locationsnulltwo-dimensional array
getlocation: double/numberArray/any
setlocation: double/number, value: anyundefined
blockstart: double, width: number, height: numbertwo-dimensional array

##Note on Set

Set will make grid.__value into a square regardless of the index given. For instance, if your grid is 3 by 3 and you grid.set([5,5],val), you will now have a 5 by 5 grid with [undefined,undefined,undefined,undefined, undefined, undefined] and your rows will be [1,2,3,undefined,undefined,undefined], i.e. It will create undefined rows and columns if you give it a bigger index than it can handle

0.1.1

7 years ago

0.1.0

7 years ago