UNPKG

grid-neighbors-1d

Version:

Get the 8 closest neighbors of a cell in a 2d grid when flattened to a 1d array

14 lines (11 loc) 526 B
# Changelog ## 2.1.0 - Added `generateNeighborLookup` to precalculate neighbors when the function will be called many times with the same grid dimensions - Improved edge case handling ## 2.0.0 - Convert code to a more modern ES6 module style, rewritten in Typescript - Added Typescript features (tsconfig.json, index.d.mts, index.d.mts.map) - Improved error handling - Improved documentation - Improved developer experience (sourcemap, type declaration, declaration map) - Lots of Github and VSCode developer features added