You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
467 B
JavaScript
22 lines
467 B
JavaScript
"use strict";
|
|
|
|
function generateSpecification(coordinates) {
|
|
if (coordinates == null) {
|
|
return undefined;
|
|
} else if (Array.isArray(coordinates)) {
|
|
let [ start, end ] = coordinates;
|
|
|
|
// NOTE: Exclusive -> inclusive conversion for second coordinate
|
|
return `${start + 1} / ${end + 2}`;
|
|
} else {
|
|
return coordinates + 1;
|
|
}
|
|
}
|
|
|
|
module.exports = function ({ x, y }) {
|
|
return {
|
|
gridColumn: generateSpecification(x),
|
|
gridRow: generateSpecification(y)
|
|
};
|
|
};
|