mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
This commit is contained in:
1 parent
8b8ccc9a81
commit
003b92f64a
3 files changed
+32
-7
No files matched your search
+11
-4
@@ -13,7 +13,14 @@ export function parseTleText(text) {
|
||||
const name = lines[i];
|
||||
const line1 = lines[i + 1];
|
||||
const line2 = lines[i + 2];
|
||||
if (line1.startsWith('1 ') && line2.startsWith('2 ')) {
|
||||
const cat1 = tleCatalogNumber(line1);
|
||||
const cat2 = tleCatalogNumber(line2);
|
||||
if (
|
||||
line1.startsWith('1 ') &&
|
||||
line2.startsWith('2 ') &&
|
||||
cat1 !== null &&
|
||||
cat1 === cat2
|
||||
) {
|
||||
result.push({ name, line1, line2 });
|
||||
i += 2;
|
||||
}
|
||||
@@ -21,8 +28,8 @@ export function parseTleText(text) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** The NORAD catalog number from TLE line 1, or null. */
|
||||
export function tleCatalogNumber(line1) {
|
||||
const number = Number.parseInt(String(line1).slice(2, 7), 10);
|
||||
/** The NORAD catalog number from a TLE line, or null. */
|
||||
export function tleCatalogNumber(line) {
|
||||
const number = Number.parseInt(String(line).slice(2, 7), 10);
|
||||
return Number.isInteger(number) ? number : null;
|
||||
}
|
||||
Reference in new issue
Block a user