Socket
Book a DemoInstallSign in
Socket

bearded-2d

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bearded-2d

A basic abstraction atop a 2 dimensional array

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

#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

FAQs

Package last updated on 23 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.