function decodeGridMap
decodeGridMap(
gridMap: string,
size: { rows: number; columns: number; }
): boolean[][]

Decodes a <gridMap> into rows of booleans.

Examples

The NVR default: every cell on

import { assertEquals } from "@std/assert";
import { decodeGridMap } from "./decode-grid-map.ts";

const grid = decodeGridMap("fffffc".repeat(18), { rows: 18, columns: 22 });

assertEquals(grid.length, 18);
assertEquals(grid.every((row) => row.length === 22 && row.every(Boolean)), true);

Parameters

gridMap: string

The hex text.

size: { rows: number; columns: number; }

The grid's <rowGranularity> and <columnGranularity>.

Return Type

boolean[][]

size.rows arrays of size.columns booleans.

Usage

import { decodeGridMap } from ".";