UNPKG

@2d-game-grid/square

Version:
13 lines (12 loc) 406 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mapCells = mapCells; /** * Converts the path coordinates into an array of cells * @param grid The grid * @param path An array of path coordinates ([x, y]) * @returns An array of cells in the same order as the path */ function mapCells(grid, path) { return path.map(([col, row]) => grid.getCell({ row, col })); }