0.0.9 • Published 4 years ago

@pelevesque/make-grid v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

Build Status Coverage Status JavaScript Style Guide

make-grid

Creates a two dimensional array arranged as a grid with x, y, w, h values on each item.

Node Repository

https://www.npmjs.com/package/@pelevesque/make-grid

Installation

npm install @pelevesque/make-grid

Tests

CommandDescription
npm test or npm run testAll Tests Below
npm run coverStandard Style
npm run standardCoverage
npm run unitUnit Tests

Usage

const makeGrid = require('@pelevesque/make-grid')
const numRows = 3
const numCols = 5
const cellWidth = 2
const cellHeight = 3
const grid = makeGrid(numRows, numCols, cellWidth, cellHeight)

// result
grid = [
  [ { x: 0, y: 0, w: 2, h: 3 },
    { x: 2, y: 0, w: 2, h: 3 },
    { x: 4, y: 0, w: 2, h: 3 },
    { x: 6, y: 0, w: 2, h: 3 },
    { x: 8, y: 0, w: 2, h: 3 }
  ], [
    { x: 0, y: 3, w: 2, h: 3 },
    { x: 2, y: 3, w: 2, h: 3 },
    { x: 4, y: 3, w: 2, h: 3 },
    { x: 6, y: 3, w: 2, h: 3 },
    { x: 8, y: 3, w: 2, h: 3 }
  ], [
    { x: 0, y: 6, w: 2, h: 3 },
    { x: 2, y: 6, w: 2, h: 3 },
    { x: 4, y: 6, w: 2, h: 3 },
    { x: 6, y: 6, w: 2, h: 3 },
    { x: 8, y: 6, w: 2, h: 3 }
  ]
]
0.0.9

4 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago