@accelint/geo 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/catalog-info.yaml +1 -1
- package/dist/cartesian.d.ts +3 -1
- package/dist/cartesian.js +34 -5
- package/dist/cartesian.js.map +1 -1
- package/dist/coordinates/coordinate.d.ts +37 -25
- package/dist/coordinates/coordinate.js +71 -77
- package/dist/coordinates/coordinate.js.map +1 -1
- package/dist/coordinates/latlon/decimal-degrees/formatter.d.ts +16 -2
- package/dist/coordinates/latlon/decimal-degrees/formatter.js +17 -3
- package/dist/coordinates/latlon/decimal-degrees/formatter.js.map +1 -1
- package/dist/coordinates/latlon/decimal-degrees/parser.d.ts +17 -4
- package/dist/coordinates/latlon/decimal-degrees/parser.js +60 -62
- package/dist/coordinates/latlon/decimal-degrees/parser.js.map +1 -1
- package/dist/coordinates/latlon/decimal-degrees/system.d.ts +16 -5
- package/dist/coordinates/latlon/decimal-degrees/system.js +26 -14
- package/dist/coordinates/latlon/decimal-degrees/system.js.map +1 -1
- package/dist/coordinates/latlon/degrees-decimal-minutes/formatter.d.ts +16 -2
- package/dist/coordinates/latlon/degrees-decimal-minutes/formatter.js +19 -8
- package/dist/coordinates/latlon/degrees-decimal-minutes/formatter.js.map +1 -1
- package/dist/coordinates/latlon/degrees-decimal-minutes/parser.d.ts +17 -4
- package/dist/coordinates/latlon/degrees-decimal-minutes/parser.js +79 -71
- package/dist/coordinates/latlon/degrees-decimal-minutes/parser.js.map +1 -1
- package/dist/coordinates/latlon/degrees-decimal-minutes/system.d.ts +16 -5
- package/dist/coordinates/latlon/degrees-decimal-minutes/system.js +30 -19
- package/dist/coordinates/latlon/degrees-decimal-minutes/system.js.map +1 -1
- package/dist/coordinates/latlon/degrees-minutes-seconds/formatter.d.ts +16 -2
- package/dist/coordinates/latlon/degrees-minutes-seconds/formatter.js +21 -10
- package/dist/coordinates/latlon/degrees-minutes-seconds/formatter.js.map +1 -1
- package/dist/coordinates/latlon/degrees-minutes-seconds/parser.d.ts +17 -4
- package/dist/coordinates/latlon/degrees-minutes-seconds/parser.js +81 -70
- package/dist/coordinates/latlon/degrees-minutes-seconds/parser.js.map +1 -1
- package/dist/coordinates/latlon/degrees-minutes-seconds/system.d.ts +16 -5
- package/dist/coordinates/latlon/degrees-minutes-seconds/system.js +32 -21
- package/dist/coordinates/latlon/degrees-minutes-seconds/system.js.map +1 -1
- package/dist/coordinates/latlon/internal/coordinate-system.d.ts +22 -9
- package/dist/coordinates/latlon/internal/coordinate-system.js +11 -2
- package/dist/coordinates/latlon/internal/create-cache.d.ts +17 -3
- package/dist/coordinates/latlon/internal/create-cache.js +27 -7
- package/dist/coordinates/latlon/internal/create-cache.js.map +1 -1
- package/dist/coordinates/latlon/internal/exhaustive-errors.d.ts +4 -2
- package/dist/coordinates/latlon/internal/exhaustive-errors.js +107 -62
- package/dist/coordinates/latlon/internal/exhaustive-errors.js.map +1 -1
- package/dist/coordinates/latlon/internal/format.d.ts +8 -6
- package/dist/coordinates/latlon/internal/format.js +24 -11
- package/dist/coordinates/latlon/internal/format.js.map +1 -1
- package/dist/coordinates/latlon/internal/in-range.d.ts +3 -1
- package/dist/coordinates/latlon/internal/in-range.js +22 -8
- package/dist/coordinates/latlon/internal/in-range.js.map +1 -1
- package/dist/coordinates/latlon/internal/index.d.ts +35 -33
- package/dist/coordinates/latlon/internal/index.js +64 -102
- package/dist/coordinates/latlon/internal/index.js.map +1 -1
- package/dist/coordinates/latlon/internal/lexer.d.ts +4 -2
- package/dist/coordinates/latlon/internal/lexer.js +54 -33
- package/dist/coordinates/latlon/internal/lexer.js.map +1 -1
- package/dist/coordinates/latlon/internal/ordinal.d.ts +3 -1
- package/dist/coordinates/latlon/internal/ordinal.js +17 -5
- package/dist/coordinates/latlon/internal/ordinal.js.map +1 -1
- package/dist/coordinates/latlon/internal/parse-format.d.ts +23 -10
- package/dist/coordinates/latlon/internal/parse-format.js +37 -54
- package/dist/coordinates/latlon/internal/parse-format.js.map +1 -1
- package/dist/coordinates/latlon/internal/parse.d.ts +18 -4
- package/dist/coordinates/latlon/internal/parse.js +55 -9
- package/dist/coordinates/latlon/internal/parse.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/check-ambiguous.d.ts +17 -3
- package/dist/coordinates/latlon/internal/pipes/check-ambiguous.js +31 -16
- package/dist/coordinates/latlon/internal/pipes/check-ambiguous.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/check-numbers.d.ts +16 -2
- package/dist/coordinates/latlon/internal/pipes/check-numbers.js +30 -28
- package/dist/coordinates/latlon/internal/pipes/check-numbers.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/fix-bearings.d.ts +18 -4
- package/dist/coordinates/latlon/internal/pipes/fix-bearings.js +66 -54
- package/dist/coordinates/latlon/internal/pipes/fix-bearings.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/fix-dividers.d.ts +18 -4
- package/dist/coordinates/latlon/internal/pipes/fix-dividers.js +42 -25
- package/dist/coordinates/latlon/internal/pipes/fix-dividers.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/genome.d.ts +16 -2
- package/dist/coordinates/latlon/internal/pipes/genome.js +46 -25
- package/dist/coordinates/latlon/internal/pipes/genome.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/index.d.ts +18 -4
- package/dist/coordinates/latlon/internal/pipes/index.js +58 -35
- package/dist/coordinates/latlon/internal/pipes/index.js.map +1 -1
- package/dist/coordinates/latlon/internal/pipes/simpler.d.ts +16 -2
- package/dist/coordinates/latlon/internal/pipes/simpler.js +25 -1
- package/dist/coordinates/latlon/internal/pipes/simpler.js.map +1 -1
- package/dist/coordinates/latlon/internal/violation.d.ts +3 -1
- package/dist/coordinates/latlon/internal/violation.js +15 -1
- package/dist/coordinates/latlon/internal/violation.js.map +1 -1
- package/dist/coordinates/mgrs/parser.d.ts +16 -4
- package/dist/coordinates/mgrs/parser.js +32 -35
- package/dist/coordinates/mgrs/parser.js.map +1 -1
- package/dist/coordinates/mgrs/system.d.ts +16 -5
- package/dist/coordinates/mgrs/system.js +28 -18
- package/dist/coordinates/mgrs/system.js.map +1 -1
- package/dist/coordinates/utm/parser.d.ts +16 -4
- package/dist/coordinates/utm/parser.js +32 -29
- package/dist/coordinates/utm/parser.js.map +1 -1
- package/dist/coordinates/utm/system.d.ts +16 -5
- package/dist/coordinates/utm/system.js +29 -18
- package/dist/coordinates/utm/system.js.map +1 -1
- package/dist/index.d.ts +24 -15
- package/dist/index.js +26 -13
- package/dist/patterning.d.ts +3 -1
- package/dist/patterning.js +75 -11
- package/dist/patterning.js.map +1 -1
- package/package.json +49 -15
- package/dist/coordinates/latlon/internal/coordinate-system.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/metafile-esm.json +0 -1
|
@@ -1,84 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
5
12
|
|
|
13
|
+
|
|
14
|
+
import { fromTemplate } from "../../../patterning.js";
|
|
15
|
+
import { BEARINGS, LIMITS, PARTIAL_PATTERNS, SYMBOLS, SYMBOL_PATTERNS } from "../internal/index.js";
|
|
16
|
+
import { createParser } from "../internal/parse-format.js";
|
|
17
|
+
import { inRange } from "../internal/in-range.js";
|
|
18
|
+
|
|
19
|
+
//#region src/coordinates/latlon/degrees-minutes-seconds/parser.ts
|
|
6
20
|
const checks = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
min: (min) => inRange("Minutes", min, 59),
|
|
16
|
-
sec: (sec) => inRange("Seconds", sec, 59.999999999)
|
|
21
|
+
deg: (deg, limit) => {
|
|
22
|
+
if (Number.parseFloat(deg) > limit) return `Degrees value (${deg}) exceeds max value (${limit}).`;
|
|
23
|
+
if (/\./.test(deg)) return `Degrees value (${deg}) must not include decimal value.`;
|
|
24
|
+
},
|
|
25
|
+
min: (min) => inRange("Minutes", min, 59),
|
|
26
|
+
sec: (sec) => inRange("Seconds", sec, 59.999999999)
|
|
17
27
|
};
|
|
18
28
|
const formats = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`degLat min secDec NS ${SYMBOLS.DIVIDER} degLon min secDec EW`
|
|
22
|
-
),
|
|
23
|
-
LONLAT: Patterning.fromTemplate(
|
|
24
|
-
PARTIAL_PATTERNS,
|
|
25
|
-
`degLon min secDec EW ${SYMBOLS.DIVIDER} degLat min secDec NS`
|
|
26
|
-
)
|
|
29
|
+
LATLON: fromTemplate(PARTIAL_PATTERNS, `degLat min secDec NS ${SYMBOLS.DIVIDER} degLon min secDec EW`),
|
|
30
|
+
LONLAT: fromTemplate(PARTIAL_PATTERNS, `degLon min secDec EW ${SYMBOLS.DIVIDER} degLat min secDec NS`)
|
|
27
31
|
};
|
|
28
32
|
function identifyErrors(format) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
return (arg, i) => {
|
|
34
|
+
if (!arg) return [[], ["Invalid coordinate value."]];
|
|
35
|
+
let { bear, deg, min, sec } = arg;
|
|
36
|
+
deg ??= "0";
|
|
37
|
+
min ||= "0";
|
|
38
|
+
sec ||= "0";
|
|
39
|
+
let isNegative = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;
|
|
40
|
+
const bearingOptions = BEARINGS[format][i];
|
|
41
|
+
if (!bear || isNegative) {
|
|
42
|
+
bear = bearingOptions[isNegative];
|
|
43
|
+
deg = Math.abs(Number.parseFloat(deg)).toString();
|
|
44
|
+
isNegative = 0;
|
|
45
|
+
}
|
|
46
|
+
const errors = [
|
|
47
|
+
...[checks.deg(deg, LIMITS[format][i] ?? 0)],
|
|
48
|
+
...[checks.min(min)],
|
|
49
|
+
...[checks.sec(sec)]
|
|
50
|
+
].filter(Boolean);
|
|
51
|
+
return errors.length ? [[], errors] : [[
|
|
52
|
+
deg,
|
|
53
|
+
min,
|
|
54
|
+
sec,
|
|
55
|
+
bear
|
|
56
|
+
], []];
|
|
57
|
+
};
|
|
51
58
|
}
|
|
52
59
|
function identifyPieces(half) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
if (half.length < 1 || half.length > 4) return;
|
|
61
|
+
const asString = half.join(" ");
|
|
62
|
+
const places = {
|
|
63
|
+
bear: "",
|
|
64
|
+
deg: "",
|
|
65
|
+
min: "",
|
|
66
|
+
sec: ""
|
|
67
|
+
};
|
|
68
|
+
const keys = [
|
|
69
|
+
"deg",
|
|
70
|
+
"min",
|
|
71
|
+
"sec"
|
|
72
|
+
];
|
|
73
|
+
const test = (r, b, v) => r.test(v) || r.test(asString) && b;
|
|
74
|
+
return half.reduce((acc, token, i, { length }) => {
|
|
75
|
+
if (test(SYMBOL_PATTERNS.NSEW, i === length - 1, token)) acc.bear ||= token;
|
|
76
|
+
else if (test(SYMBOL_PATTERNS.DEGREES, i === 0, token)) acc.deg ||= token;
|
|
77
|
+
else if (test(SYMBOL_PATTERNS.MINUTES, i === 1, token)) acc.min ||= token;
|
|
78
|
+
else if (test(SYMBOL_PATTERNS.SECONDS, i === 2, token)) acc.sec ||= token;
|
|
79
|
+
else {
|
|
80
|
+
const key = keys.find((k) => !acc[k]);
|
|
81
|
+
acc[key] = token;
|
|
82
|
+
}
|
|
83
|
+
return acc;
|
|
84
|
+
}, places);
|
|
75
85
|
}
|
|
86
|
+
/** Parse a Degrees Minutes Seconds coordinate. */
|
|
76
87
|
const parseDegreesMinutesSeconds = createParser({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
formats,
|
|
89
|
+
identifyErrors,
|
|
90
|
+
identifyPieces
|
|
80
91
|
});
|
|
81
92
|
|
|
93
|
+
//#endregion
|
|
82
94
|
export { parseDegreesMinutesSeconds };
|
|
83
|
-
//# sourceMappingURL=parser.js.map
|
|
84
95
|
//# sourceMappingURL=parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"parser.js","names":["Patterning.fromTemplate","isNegative: 0 | 1"],"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/parser.ts"],"sourcesContent":["/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport * as Patterning from '@/patterning';\nimport {\n BEARINGS,\n type Format,\n LIMITS,\n PARTIAL_PATTERNS,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { inRange } from '../internal/in-range';\nimport { createParser } from '../internal/parse-format';\nimport type { ParseResults } from '../internal/parse';\n\ntype DegreesMinutesSeconds = {\n bear: string;\n deg: string;\n min: string;\n sec: string;\n};\n\nconst checks = {\n deg: (deg: string, limit: number) => {\n if (Number.parseFloat(deg) > limit) {\n return `Degrees value (${deg}) exceeds max value (${limit}).`;\n }\n\n if (/\\./.test(deg)) {\n return `Degrees value (${deg}) must not include decimal value.`;\n }\n },\n min: (min: string) => inRange('Minutes', min, 59),\n sec: (sec: string) => inRange('Seconds', sec, 59.999999999),\n};\n\nconst formats = {\n LATLON: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLat min secDec NS ${SYMBOLS.DIVIDER} degLon min secDec EW`,\n ),\n LONLAT: Patterning.fromTemplate(\n PARTIAL_PATTERNS,\n `degLon min secDec EW ${SYMBOLS.DIVIDER} degLat min secDec NS`,\n ),\n};\n\nfunction identifyErrors(format: Format) {\n return (arg: DegreesMinutesSeconds | undefined, i: number) => {\n if (!arg) {\n return [[], ['Invalid coordinate value.']] as ParseResults;\n }\n\n let { bear, deg, min, sec } = arg;\n\n deg ??= '0';\n // NOTE: need `||=` not `??=` because empty-string is not nullish\n min ||= '0';\n sec ||= '0';\n\n let isNegative: 0 | 1 = SYMBOL_PATTERNS.NEGATIVE_SIGN.test(deg) ? 1 : 0;\n const bearingOptions = BEARINGS[format][i] as [string, string];\n\n if (!bear || isNegative) {\n bear = bearingOptions[isNegative];\n deg = Math.abs(Number.parseFloat(deg)).toString();\n isNegative = 0;\n }\n\n const errors = [\n ...[checks.deg(deg, LIMITS[format][i] ?? 0)],\n ...[checks.min(min)],\n ...[checks.sec(sec)],\n ].filter(Boolean);\n\n return (\n errors.length ? [[], errors] : [[deg, min, sec, bear], []]\n ) as ParseResults;\n };\n}\n\nfunction identifyPieces(half: string[]) {\n if (half.length < 1 || half.length > 4) {\n return;\n }\n\n const asString = half.join(' ');\n const places = { bear: '', deg: '', min: '', sec: '' };\n const keys = ['deg', 'min', 'sec'] as (keyof typeof places)[];\n const test = (r: RegExp, b: boolean, v: string) =>\n r.test(v) || (r.test(asString) && b);\n\n return half.reduce((acc, token, i, { length }) => {\n if (test(SYMBOL_PATTERNS.NSEW, i === length - 1, token)) {\n acc.bear ||= token;\n } else if (test(SYMBOL_PATTERNS.DEGREES, i === 0, token)) {\n acc.deg ||= token;\n } else if (test(SYMBOL_PATTERNS.MINUTES, i === 1, token)) {\n acc.min ||= token;\n } else if (test(SYMBOL_PATTERNS.SECONDS, i === 2, token)) {\n acc.sec ||= token;\n } else {\n const key = keys.find((k) => !acc[k]);\n\n acc[key as keyof typeof acc] = token;\n }\n\n return acc;\n }, places);\n}\n\n/** Parse a Degrees Minutes Seconds coordinate. */\nexport const parseDegreesMinutesSeconds = createParser<DegreesMinutesSeconds>({\n formats,\n identifyErrors,\n identifyPieces,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,MAAM,SAAS;CACb,MAAM,KAAa,UAAkB;AACnC,MAAI,OAAO,WAAW,IAAI,GAAG,MAC3B,QAAO,kBAAkB,IAAI,uBAAuB,MAAM;AAG5D,MAAI,KAAK,KAAK,IAAI,CAChB,QAAO,kBAAkB,IAAI;;CAGjC,MAAM,QAAgB,QAAQ,WAAW,KAAK,GAAG;CACjD,MAAM,QAAgB,QAAQ,WAAW,KAAK,aAAa;CAC5D;AAED,MAAM,UAAU;CACd,QAAQA,aACN,kBACA,wBAAwB,QAAQ,QAAQ,uBACzC;CACD,QAAQA,aACN,kBACA,wBAAwB,QAAQ,QAAQ,uBACzC;CACF;AAED,SAAS,eAAe,QAAgB;AACtC,SAAQ,KAAwC,MAAc;AAC5D,MAAI,CAAC,IACH,QAAO,CAAC,EAAE,EAAE,CAAC,4BAA4B,CAAC;EAG5C,IAAI,EAAE,MAAM,KAAK,KAAK,QAAQ;AAE9B,UAAQ;AAER,UAAQ;AACR,UAAQ;EAER,IAAIC,aAAoB,gBAAgB,cAAc,KAAK,IAAI,GAAG,IAAI;EACtE,MAAM,iBAAiB,SAAS,QAAQ;AAExC,MAAI,CAAC,QAAQ,YAAY;AACvB,UAAO,eAAe;AACtB,SAAM,KAAK,IAAI,OAAO,WAAW,IAAI,CAAC,CAAC,UAAU;AACjD,gBAAa;;EAGf,MAAM,SAAS;GACb,GAAG,CAAC,OAAO,IAAI,KAAK,OAAO,QAAQ,MAAM,EAAE,CAAC;GAC5C,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC;GACpB,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC;GACrB,CAAC,OAAO,QAAQ;AAEjB,SACE,OAAO,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,CAAC;GAAC;GAAK;GAAK;GAAK;GAAK,EAAE,EAAE,CAAC;;;AAKhE,SAAS,eAAe,MAAgB;AACtC,KAAI,KAAK,SAAS,KAAK,KAAK,SAAS,EACnC;CAGF,MAAM,WAAW,KAAK,KAAK,IAAI;CAC/B,MAAM,SAAS;EAAE,MAAM;EAAI,KAAK;EAAI,KAAK;EAAI,KAAK;EAAI;CACtD,MAAM,OAAO;EAAC;EAAO;EAAO;EAAM;CAClC,MAAM,QAAQ,GAAW,GAAY,MACnC,EAAE,KAAK,EAAE,IAAK,EAAE,KAAK,SAAS,IAAI;AAEpC,QAAO,KAAK,QAAQ,KAAK,OAAO,GAAG,EAAE,aAAa;AAChD,MAAI,KAAK,gBAAgB,MAAM,MAAM,SAAS,GAAG,MAAM,CACrD,KAAI,SAAS;WACJ,KAAK,gBAAgB,SAAS,MAAM,GAAG,MAAM,CACtD,KAAI,QAAQ;WACH,KAAK,gBAAgB,SAAS,MAAM,GAAG,MAAM,CACtD,KAAI,QAAQ;WACH,KAAK,gBAAgB,SAAS,MAAM,GAAG,MAAM,CACtD,KAAI,QAAQ;OACP;GACL,MAAM,MAAM,KAAK,MAAM,MAAM,CAAC,IAAI,GAAG;AAErC,OAAI,OAA2B;;AAGjC,SAAO;IACN,OAAO;;;AAIZ,MAAa,6BAA6B,aAAoC;CAC5E;CACA;CACA;CACD,CAAC"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
5
12
|
|
|
6
|
-
|
|
13
|
+
import { CoordinateSystem } from "../internal/coordinate-system.js";
|
|
7
14
|
|
|
15
|
+
//#region src/coordinates/latlon/degrees-minutes-seconds/system.d.ts
|
|
16
|
+
declare const systemDegreesMinutesSeconds: CoordinateSystem;
|
|
17
|
+
//#endregion
|
|
8
18
|
export { systemDegreesMinutesSeconds };
|
|
19
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
3
12
|
|
|
13
|
+
|
|
14
|
+
import { BEARINGS, SYMBOLS, SYMBOL_PATTERNS } from "../internal/index.js";
|
|
15
|
+
import { parseDegreesMinutesSeconds } from "./parser.js";
|
|
16
|
+
|
|
17
|
+
//#region src/coordinates/latlon/degrees-minutes-seconds/system.ts
|
|
4
18
|
const systemDegreesMinutesSeconds = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return `${deg} ${min} ${sec} ${BEARINGS[format][index][+(num < 0)]}`;
|
|
21
|
-
}).join(` ${SYMBOLS.DIVIDER} `);
|
|
22
|
-
}
|
|
19
|
+
name: "Degrees Minutes Seconds",
|
|
20
|
+
parse: parseDegreesMinutesSeconds,
|
|
21
|
+
toFloat(arg) {
|
|
22
|
+
const [degrees, minutes, seconds, bear] = arg;
|
|
23
|
+
return Number.parseFloat(((Number.parseFloat(degrees) + Number.parseFloat(minutes) / 60 + Number.parseFloat(seconds) / 3600) * (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)).toFixed(9));
|
|
24
|
+
},
|
|
25
|
+
toFormat(format, [left, right]) {
|
|
26
|
+
return [left, right].map((num, index) => {
|
|
27
|
+
const abs = Math.abs(num);
|
|
28
|
+
const deg = Math.floor(abs);
|
|
29
|
+
const rem = (abs - deg) * 60;
|
|
30
|
+
const min = Math.floor(rem);
|
|
31
|
+
return `${deg} ${min} ${Number.parseFloat(((rem - min) * 60).toFixed(9))} ${BEARINGS[format][index][+(num < 0)]}`;
|
|
32
|
+
}).join(` ${SYMBOLS.DIVIDER} `);
|
|
33
|
+
}
|
|
23
34
|
};
|
|
24
35
|
|
|
36
|
+
//#endregion
|
|
25
37
|
export { systemDegreesMinutesSeconds };
|
|
26
|
-
//# sourceMappingURL=system.js.map
|
|
27
38
|
//# sourceMappingURL=system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/system.ts"],"
|
|
1
|
+
{"version":3,"file":"system.js","names":["systemDegreesMinutesSeconds: CoordinateSystem"],"sources":["../../../../src/coordinates/latlon/degrees-minutes-seconds/system.ts"],"sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n BEARINGS,\n type Compass,\n type Format,\n SYMBOL_PATTERNS,\n SYMBOLS,\n} from '../internal';\nimport { parseDegreesMinutesSeconds } from './parser';\nimport type { CoordinateSystem } from '../internal/coordinate-system';\n\nexport const systemDegreesMinutesSeconds: CoordinateSystem = {\n name: 'Degrees Minutes Seconds',\n\n parse: parseDegreesMinutesSeconds,\n\n toFloat(arg) {\n const [degrees, minutes, seconds, bear] = arg as [\n string,\n string,\n string,\n Compass,\n ];\n\n return Number.parseFloat(\n (\n (Number.parseFloat(degrees) +\n Number.parseFloat(minutes) / 60 +\n Number.parseFloat(seconds) / 3600) *\n (SYMBOL_PATTERNS.NEGATIVE_BEARINGS.test(bear) ? -1 : 1)\n ).toFixed(9),\n );\n },\n\n toFormat(format: Format, [left, right]: [number, number]) {\n return [left, right]\n .map((num, index) => {\n const abs = Math.abs(num);\n const deg = Math.floor(abs);\n const rem = (abs - deg) * 60;\n const min = Math.floor(rem);\n const sec = Number.parseFloat(((rem - min) * 60).toFixed(9));\n\n return `${deg} ${min} ${sec} ${BEARINGS[format][index as 0 | 1][+(num < 0)]}`;\n })\n .join(` ${SYMBOLS.DIVIDER} `);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAaA,8BAAgD;CAC3D,MAAM;CAEN,OAAO;CAEP,QAAQ,KAAK;EACX,MAAM,CAAC,SAAS,SAAS,SAAS,QAAQ;AAO1C,SAAO,OAAO,aAET,OAAO,WAAW,QAAQ,GACzB,OAAO,WAAW,QAAQ,GAAG,KAC7B,OAAO,WAAW,QAAQ,GAAG,SAC9B,gBAAgB,kBAAkB,KAAK,KAAK,GAAG,KAAK,IACrD,QAAQ,EAAE,CACb;;CAGH,SAAS,QAAgB,CAAC,MAAM,QAA0B;AACxD,SAAO,CAAC,MAAM,MAAM,CACjB,KAAK,KAAK,UAAU;GACnB,MAAM,MAAM,KAAK,IAAI,IAAI;GACzB,MAAM,MAAM,KAAK,MAAM,IAAI;GAC3B,MAAM,OAAO,MAAM,OAAO;GAC1B,MAAM,MAAM,KAAK,MAAM,IAAI;AAG3B,UAAO,GAAG,IAAI,GAAG,IAAI,GAFT,OAAO,aAAa,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC,CAEhC,GAAG,SAAS,QAAQ,OAAgB,EAAE,MAAM;IACxE,CACD,KAAK,IAAI,QAAQ,QAAQ,GAAG;;CAElC"}
|
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
4
12
|
|
|
13
|
+
import { Compass, Format } from "./index.js";
|
|
14
|
+
import { ParseResults } from "./parse.js";
|
|
15
|
+
|
|
16
|
+
//#region src/coordinates/latlon/internal/coordinate-system.d.ts
|
|
5
17
|
type CoordinateSystem = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
name: string;
|
|
19
|
+
parse: (format: Format, input: string) => ParseResults;
|
|
20
|
+
toFloat: (a: [string, ...string[], Compass]) => number;
|
|
21
|
+
toFormat: (f: Format, a: [number, number]) => string;
|
|
10
22
|
};
|
|
11
|
-
|
|
12
|
-
export
|
|
23
|
+
//#endregion
|
|
24
|
+
export { CoordinateSystem };
|
|
25
|
+
//# sourceMappingURL=coordinate-system.d.ts.map
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
1
12
|
|
|
2
|
-
//# sourceMappingURL=coordinate-system.js.map
|
|
3
|
-
//# sourceMappingURL=coordinate-system.js.map
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
2
12
|
|
|
13
|
+
import { Format } from "./index.js";
|
|
14
|
+
|
|
15
|
+
//#region src/coordinates/latlon/internal/create-cache.d.ts
|
|
3
16
|
type CoordinateCache = Record<Format, string>;
|
|
4
17
|
/**
|
|
5
18
|
* Create, and initialize, a cache object for coordinate conversions so that
|
|
@@ -8,5 +21,6 @@ type CoordinateCache = Record<Format, string>;
|
|
|
8
21
|
* errors when converting between multiple formats.
|
|
9
22
|
* */
|
|
10
23
|
declare function createCache(format: Format, value: string): CoordinateCache;
|
|
11
|
-
|
|
12
|
-
export {
|
|
24
|
+
//#endregion
|
|
25
|
+
export { CoordinateCache, createCache };
|
|
26
|
+
//# sourceMappingURL=create-cache.d.ts.map
|
|
@@ -1,14 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
2
12
|
|
|
13
|
+
|
|
14
|
+
import { FORMATS, SYMBOLS } from "./index.js";
|
|
15
|
+
|
|
16
|
+
//#region src/coordinates/latlon/internal/create-cache.ts
|
|
3
17
|
const DIVIDER = ` ${SYMBOLS.DIVIDER} `;
|
|
18
|
+
/**
|
|
19
|
+
* Create, and initialize, a cache object for coordinate conversions so that
|
|
20
|
+
* conversions are only ever done once and only "one-direction-ally". The
|
|
21
|
+
* "one-direction" concept is to avoid the problem of encountering rounding
|
|
22
|
+
* errors when converting between multiple formats.
|
|
23
|
+
* */
|
|
4
24
|
function createCache(format, value) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
const [alternate] = FORMATS.filter((o) => o !== format);
|
|
26
|
+
return {
|
|
27
|
+
[format]: value,
|
|
28
|
+
[alternate]: value.includes(SYMBOLS.DIVIDER) ? value.split(DIVIDER).reverse().join(DIVIDER).trim() : value
|
|
29
|
+
};
|
|
10
30
|
}
|
|
11
31
|
|
|
32
|
+
//#endregion
|
|
12
33
|
export { createCache };
|
|
13
|
-
//# sourceMappingURL=create-cache.js.map
|
|
14
34
|
//# sourceMappingURL=create-cache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"create-cache.js","names":[],"sources":["../../../../src/coordinates/latlon/internal/create-cache.ts"],"sourcesContent":["// __private-exports\n/*\n * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { FORMATS, type Format, SYMBOLS } from '.';\n\nexport type CoordinateCache = Record<Format, string>;\n\nconst DIVIDER = ` ${SYMBOLS.DIVIDER} `;\n\n/**\n * Create, and initialize, a cache object for coordinate conversions so that\n * conversions are only ever done once and only \"one-direction-ally\". The\n * \"one-direction\" concept is to avoid the problem of encountering rounding\n * errors when converting between multiple formats.\n * */\nexport function createCache(format: Format, value: string) {\n const [alternate] = FORMATS.filter((o) => o !== format) as [Format];\n\n return {\n [format]: value,\n [alternate]: value.includes(SYMBOLS.DIVIDER)\n ? value.split(DIVIDER).reverse().join(DIVIDER).trim()\n : value,\n } as CoordinateCache;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,UAAU,IAAI,QAAQ,QAAQ;;;;;;;AAQpC,SAAgB,YAAY,QAAgB,OAAe;CACzD,MAAM,CAAC,aAAa,QAAQ,QAAQ,MAAM,MAAM,OAAO;AAEvD,QAAO;GACJ,SAAS;GACT,YAAY,MAAM,SAAS,QAAQ,QAAQ,GACxC,MAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,MAAM,GACnD;EACL"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
//#region src/coordinates/latlon/internal/exhaustive-errors.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* A collection of input strings each with exactly one error in a unique
|
|
3
4
|
* position for each format (LATLON and LONLAT) in each system (DD, DDM, DMS).
|
|
4
5
|
*/
|
|
5
6
|
declare const EXHAUSTIVE_ERRORS: {
|
|
6
|
-
|
|
7
|
+
[k: string]: any;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
//#endregion
|
|
9
10
|
export { EXHAUSTIVE_ERRORS };
|
|
11
|
+
//# sourceMappingURL=exhaustive-errors.d.ts.map
|
|
@@ -1,71 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
2
12
|
|
|
13
|
+
|
|
14
|
+
import { cartesian } from "../../../cartesian.js";
|
|
15
|
+
|
|
16
|
+
//#region src/coordinates/latlon/internal/exhaustive-errors.ts
|
|
3
17
|
const values = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
invalid: {
|
|
19
|
+
BLAT: ["X", "random garbage"],
|
|
20
|
+
BLON: ["X", "random garbage"],
|
|
21
|
+
DLAT: ["91", "nope"],
|
|
22
|
+
DDLAT: ["90.1", "nope"],
|
|
23
|
+
DLON: ["181", "nope"],
|
|
24
|
+
DDLON: ["180.1", "nope"],
|
|
25
|
+
M: [
|
|
26
|
+
"-1",
|
|
27
|
+
"61",
|
|
28
|
+
"nope"
|
|
29
|
+
],
|
|
30
|
+
MM: [
|
|
31
|
+
"-0.1",
|
|
32
|
+
"60.1",
|
|
33
|
+
"nope"
|
|
34
|
+
],
|
|
35
|
+
SS: [
|
|
36
|
+
"-0.1",
|
|
37
|
+
"60.1",
|
|
38
|
+
"nope"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
valid: {
|
|
42
|
+
"/": "/",
|
|
43
|
+
BLAT: "N",
|
|
44
|
+
BLON: "E",
|
|
45
|
+
DLAT: "89",
|
|
46
|
+
DDLAT: "89.999999999",
|
|
47
|
+
DLON: "179",
|
|
48
|
+
DDLON: "179.999999999",
|
|
49
|
+
M: "59",
|
|
50
|
+
MM: "59.999999999",
|
|
51
|
+
SS: "59.999999999"
|
|
52
|
+
}
|
|
27
53
|
};
|
|
28
54
|
const systems = [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
{
|
|
56
|
+
designation: "DD",
|
|
57
|
+
LAT: [
|
|
58
|
+
"DDLAT",
|
|
59
|
+
"BLAT DDLAT",
|
|
60
|
+
"DDLAT BLAT"
|
|
61
|
+
],
|
|
62
|
+
LON: [
|
|
63
|
+
"DDLON",
|
|
64
|
+
"BLON DDLON",
|
|
65
|
+
"DDLON BLON"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
designation: "DDM",
|
|
70
|
+
LAT: [
|
|
71
|
+
"DLAT MM",
|
|
72
|
+
"BLAT DLAT MM",
|
|
73
|
+
"DLAT MM BLAT"
|
|
74
|
+
],
|
|
75
|
+
LON: [
|
|
76
|
+
"DLON MM",
|
|
77
|
+
"BLON DLON MM",
|
|
78
|
+
"DLON MM BLON"
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
designation: "DMS",
|
|
83
|
+
LAT: [
|
|
84
|
+
"DLAT M SS",
|
|
85
|
+
"BLAT DLAT M SS",
|
|
86
|
+
"DLAT M SS BLAT"
|
|
87
|
+
],
|
|
88
|
+
LON: [
|
|
89
|
+
"DLON M SS",
|
|
90
|
+
"BLON DLON M SS",
|
|
91
|
+
"DLON M SS BLON"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
44
94
|
];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return values2.invalid[key].map(
|
|
64
|
-
(opt) => [...original.slice(0, i), opt, ...original.slice(i + 1)].map((token) => token in values2.valid ? values2.valid[token] : token).join(" ")
|
|
65
|
-
);
|
|
66
|
-
}).filter(Boolean);
|
|
95
|
+
/**
|
|
96
|
+
* A collection of input strings each with exactly one error in a unique
|
|
97
|
+
* position for each format (LATLON and LONLAT) in each system (DD, DDM, DMS).
|
|
98
|
+
*/
|
|
99
|
+
const EXHAUSTIVE_ERRORS = Object.fromEntries(systems.map(({ designation, ...system }) => {
|
|
100
|
+
const options = ["LAT LON", "LON LAT"].map((format) => [format.replace(" ", ""), cartesian(...format.split(" ").map((key) => system[key])).map((pair) => pair.join(" / ")).flatMap((t) => fillTemplate(t, values))]);
|
|
101
|
+
return [designation, Object.fromEntries(options)];
|
|
102
|
+
}));
|
|
103
|
+
function fillTemplate(template, values$1) {
|
|
104
|
+
return template.split(" ").flatMap((key, i, original) => {
|
|
105
|
+
if (!values$1.invalid[key]) return "";
|
|
106
|
+
return values$1.invalid[key].map((opt) => [
|
|
107
|
+
...original.slice(0, i),
|
|
108
|
+
opt,
|
|
109
|
+
...original.slice(i + 1)
|
|
110
|
+
].map((token) => token in values$1.valid ? values$1.valid[token] : token).join(" "));
|
|
111
|
+
}).filter(Boolean);
|
|
67
112
|
}
|
|
68
113
|
|
|
114
|
+
//#endregion
|
|
69
115
|
export { EXHAUSTIVE_ERRORS };
|
|
70
|
-
//# sourceMappingURL=exhaustive-errors.js.map
|
|
71
116
|
//# sourceMappingURL=exhaustive-errors.js.map
|