UNPKG

led-canvas-matrix

Version:

Matrix Class providing basic data structures for led-canvas and led-canvas-text

16 lines (12 loc) 273 B
"use strict"; function populate(x, y, LedFactory) { var length = x * y; var leds = []; for (var i = 0; i < length; i++) { var yc = Math.floor(i / x); var xc = i - (x * yc); leds.push(LedFactory(xc, yc)); } return leds; } module.exports = populate;