you could make this a bit better by just flattening the data and using a utility like lodash's groupBy. Then you can do something like withIndexAsXY = (fn, index) => fn(index % 9, Math.floor(index / 9)); and use the above functions on flattened data like:
you could make this a bit better by just flattening the data and using a utility like lodash's groupBy. Then you can do something like withIndexAsXY = (fn, index) => fn(index % 9, Math.floor(index / 9)); and use the above functions on flattened data like:
which may seem more complicated - but it means things have become more reusable