Convert all remaining tabs by 2spaces
[vchess.git] / client / src / utils / squareId.js
CommitLineData
582df349 1// Get the identifier of a HTML square from its numeric coordinates o.x,o.y.
8d61fc4a 2export function getSquareId(o)
582df349 3{
dac39588
BA
4 // NOTE: a separator is required to allow any size of board
5 return "sq-" + o.x + "-" + o.y;
582df349
BA
6}
7
8// Inverse function
8d61fc4a 9export function getSquareFromId(id)
a3ab5fdb 10{
dac39588
BA
11 const idParts = id.split('-');
12 return [parseInt(idParts[1]), parseInt(idParts[2])];
582df349 13}