Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1x 1x 6x 6x 5x 4x 5x 1x 1x 1x 1x 1x 6x 1x 1x 6x 6x | import { maxGalacticCoordLength, minGalacticCoordLength } from '@/constants/restrictions';
import type { GalacticInput } from '@/types/galacticTypes';
export const handleGalacticCoordinate = (input: GalacticInput): string => {
let inputCoords = '';
if (input.code != null) {
if (input.code.length === maxGalacticCoordLength) {
inputCoords = input.code;
} else if (input.code.length === minGalacticCoordLength) {
inputCoords = input.code
.split('') // convert 0C5500D509220234 to 0C55:00D5:0922:0234
.flatMap((c, idx) => (idx !== minGalacticCoordLength - 1 && idx % 4 === 3 ? [c, ':'] : [c]))
.join('');
}
} else if (input.groups != null) {
inputCoords = input.groups.join(':');
}
return inputCoords;
};
|