projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code reorganization
[vchess.git]
/
client
/
src
/
utils
/
squareId.js
diff --git
a/client/client_OLD/javascripts/utils/squareId.js
b/client/src/utils/squareId.js
similarity index 81%
rename from
client/client_OLD/javascripts/utils/squareId.js
rename to
client/src/utils/squareId.js
index
8fec48e
..
a68b51f
100644
(file)
--- a/
client/client_OLD/javascripts/utils/squareId.js
+++ b/
client/src/utils/squareId.js
@@
-1,12
+1,12
@@
// Get the identifier of a HTML square from its numeric coordinates o.x,o.y.
// Get the identifier of a HTML square from its numeric coordinates o.x,o.y.
-function getSquareId(o)
+
export
function getSquareId(o)
{
// NOTE: a separator is required to allow any size of board
return "sq-" + o.x + "-" + o.y;
}
// Inverse function
{
// NOTE: a separator is required to allow any size of board
return "sq-" + o.x + "-" + o.y;
}
// Inverse function
-function getSquareFromId(id)
+
export
function getSquareFromId(id)
{
const idParts = id.split('-');
return [parseInt(idParts[1]), parseInt(idParts[2])];
{
const idParts = id.split('-');
return [parseInt(idParts[1]), parseInt(idParts[2])];