Created
October 11, 2022 18:04
-
-
Save jose-mdz/536421e97888a5f38b6ae173154acbfe to your computer and use it in GitHub Desktop.
Revisions
-
jose-mdz created this gist
Oct 11, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ const getIndex = (row: number, col: number, width: number) => width * row + col; const getRowCol = (index: number, width: number) => [Math.floor(index / width), index % width];