ixfx
    Preparing search index...
    • Returns neighbours for a cell. If no directions are provided, it defaults to allDirections.

      const grid = { rows: 5, cols: 5 };
      const cell = { x:2, y:2 };

      // Get n,ne,nw,e,s,se,sw and w neighbours
      const n = Grids.neighbours(grid, cell, `wrap`);

      Yields:
      {
      n: {x: 2, y: 1}
      s: {x: 2, y: 3}
      ....
      }

      Returns neighbours without diagonals (ie: n, e, s, w):

      const n = Grids.neighbours(grid, cell, `stop`, Grids.crossDirections);
      

      Parameters

      Returns GridNeighbours

      Returns a map of cells, keyed by cardinal direction