UNPKG

@2d-game-grid/square

Version:
10 lines (9 loc) 307 B
/** * 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 */ export function mapCells(grid, path) { return path.map(([col, row]) => grid.getCell({ row, col })); }