@accelint/geo 0.1.1 → 0.1.3

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.
@@ -1,4 +1,6 @@
1
- export declare const ddPairs: string[][];
2
- export declare const dmsPairs: string[][];
3
- export declare const ddmPairs: never[];
4
- export declare const mixedPairs: never[];
1
+ declare const ddPairs: string[][];
2
+ declare const dmsPairs: string[][];
3
+ declare const ddmPairs: never[];
4
+ declare const mixedPairs: never[];
5
+
6
+ export { ddPairs, ddmPairs, dmsPairs, mixedPairs };
@@ -1,50 +1,39 @@
1
- /*
2
- * Copyright 2024 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
- */
12
- // const LAT_DD = 40.689247;
13
- // const LON_DD = -74.044502;
14
- export const ddPairs = [
15
- ['partial', '40, -74'],
16
- ['partial directions prefix', 'N 40, W 74'],
17
- ['partial directions prefix no space', 'N40, W74'],
18
- ['partial directions suffix', '40 N, 74 W'],
19
- ['partial directions suffix no space', '40N, 74W'],
20
- ['plus minus', '+40.689247, -74.044502'],
21
- ['inferred plus', '40.689247, -74.044502'],
22
- ['inferred positive direction', '40.689247, 74.044502 W'],
23
- ['degree delimeters', '40.689247° N, 74.044502° W'],
24
- ['separator ,', '40.689247,-74.044502'],
25
- ['separator /', '40.689247/-74.044502'],
26
- ['separator space', '40.689247 -74.044502'],
27
- ['NSEW directions prefix', 'N 40.689247, W 74.044502'],
28
- ['NSEW directions prefix no space', 'N40.689247, W74.044502'],
29
- ['NSEW directions suffix', '40.689247 N, 74.044502 W'],
30
- ['NSEW directions suffix no space', '40.689247N, 74.044502W'],
31
- ['mixed plus minus and directions', '+40.689247, W74.044502'],
32
- ['mixed full and partial', '40.689247, W74'],
33
- ['odd whitespace', ' + 40.689247 , - 74.044502 '],
1
+ // src/coordinates/__fixtures__/index.ts
2
+ var ddPairs = [
3
+ ["partial", "40, -74"],
4
+ ["partial directions prefix", "N 40, W 74"],
5
+ ["partial directions prefix no space", "N40, W74"],
6
+ ["partial directions suffix", "40 N, 74 W"],
7
+ ["partial directions suffix no space", "40N, 74W"],
8
+ ["plus minus", "+40.689247, -74.044502"],
9
+ ["inferred plus", "40.689247, -74.044502"],
10
+ ["inferred positive direction", "40.689247, 74.044502 W"],
11
+ ["degree delimeters", "40.689247\xB0 N, 74.044502\xB0 W"],
12
+ ["separator ,", "40.689247,-74.044502"],
13
+ ["separator /", "40.689247/-74.044502"],
14
+ ["separator space", "40.689247 -74.044502"],
15
+ ["NSEW directions prefix", "N 40.689247, W 74.044502"],
16
+ ["NSEW directions prefix no space", "N40.689247, W74.044502"],
17
+ ["NSEW directions suffix", "40.689247 N, 74.044502 W"],
18
+ ["NSEW directions suffix no space", "40.689247N, 74.044502W"],
19
+ ["mixed plus minus and directions", "+40.689247, W74.044502"],
20
+ ["mixed full and partial", "40.689247, W74"],
21
+ ["odd whitespace", " + 40.689247 , - 74.044502 "]
34
22
  ];
35
- // const LAT_DMS = `40° 41' 21.2892"`;
36
- // const LON_DMS = `-74° 02' 40.2066"`;
37
- export const dmsPairs = [
38
- ['partial no delimeters', '40 41 -74 02'],
39
- ['partial delimeters', `40° 41' -74 02'`],
40
- ['plus minus no delimeters', '+40 41 21.2892 -74 02 40.2066'],
41
- ['plus minus delimeters', `+40° 41' 21.2892" -74° 02' 40.2066"`],
42
- ['directions no delimeters', '40 41 21.2892 N 74 02 40.2066 W'],
43
- ['directions delimeters', `40° 41' 21.2892" N 74° 02' 40.2066" W`],
44
- ['separator ,', `40° 41' 21.2892",-74° 02' 40.2066"`],
45
- ['separator /', `40° 41' 21.2892"/-74° 02' 40.2066"`],
46
- ['separator space', `40° 41' 21.2892" -74° 02' 40.2066"`],
23
+ var dmsPairs = [
24
+ ["partial no delimeters", "40 41 -74 02"],
25
+ ["partial delimeters", `40\xB0 41' -74 02'`],
26
+ ["plus minus no delimeters", "+40 41 21.2892 -74 02 40.2066"],
27
+ ["plus minus delimeters", `+40\xB0 41' 21.2892" -74\xB0 02' 40.2066"`],
28
+ ["directions no delimeters", "40 41 21.2892 N 74 02 40.2066 W"],
29
+ ["directions delimeters", `40\xB0 41' 21.2892" N 74\xB0 02' 40.2066" W`],
30
+ ["separator ,", `40\xB0 41' 21.2892",-74\xB0 02' 40.2066"`],
31
+ ["separator /", `40\xB0 41' 21.2892"/-74\xB0 02' 40.2066"`],
32
+ ["separator space", `40\xB0 41' 21.2892" -74\xB0 02' 40.2066"`]
47
33
  ];
48
- export const ddmPairs = [];
49
- export const mixedPairs = [];
34
+ var ddmPairs = [];
35
+ var mixedPairs = [];
36
+
37
+ export { ddPairs, ddmPairs, dmsPairs, mixedPairs };
38
+ //# sourceMappingURL=index.js.map
50
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/coordinates/__fixtures__/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,4BAA4B;AAC5B,6BAA6B;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,2BAA2B,EAAE,YAAY,CAAC;IAC3C,CAAC,oCAAoC,EAAE,UAAU,CAAC;IAClD,CAAC,2BAA2B,EAAE,YAAY,CAAC;IAC3C,CAAC,oCAAoC,EAAE,UAAU,CAAC;IAClD,CAAC,YAAY,EAAE,wBAAwB,CAAC;IACxC,CAAC,eAAe,EAAE,uBAAuB,CAAC;IAC1C,CAAC,6BAA6B,EAAE,wBAAwB,CAAC;IACzD,CAAC,mBAAmB,EAAE,4BAA4B,CAAC;IACnD,CAAC,aAAa,EAAE,sBAAsB,CAAC;IACvC,CAAC,aAAa,EAAE,sBAAsB,CAAC;IACvC,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IAC3C,CAAC,wBAAwB,EAAE,0BAA0B,CAAC;IACtD,CAAC,iCAAiC,EAAE,wBAAwB,CAAC;IAC7D,CAAC,wBAAwB,EAAE,0BAA0B,CAAC;IACtD,CAAC,iCAAiC,EAAE,wBAAwB,CAAC;IAC7D,CAAC,iCAAiC,EAAE,wBAAwB,CAAC;IAC7D,CAAC,wBAAwB,EAAE,gBAAgB,CAAC;IAC5C,CAAC,gBAAgB,EAAE,oCAAoC,CAAC;CACzD,CAAC;AAEF,sCAAsC;AACtC,uCAAuC;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,CAAC,uBAAuB,EAAE,cAAc,CAAC;IACzC,CAAC,oBAAoB,EAAE,iBAAiB,CAAC;IACzC,CAAC,0BAA0B,EAAE,+BAA+B,CAAC;IAC7D,CAAC,uBAAuB,EAAE,qCAAqC,CAAC;IAChE,CAAC,0BAA0B,EAAE,iCAAiC,CAAC;IAC/D,CAAC,uBAAuB,EAAE,uCAAuC,CAAC;IAClE,CAAC,aAAa,EAAE,oCAAoC,CAAC;IACrD,CAAC,aAAa,EAAE,oCAAoC,CAAC;IACrD,CAAC,iBAAiB,EAAE,oCAAoC,CAAC;CAC1D,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,CAAC;AAE3B,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,CAAC"}
1
+ {"version":3,"sources":["../../../src/coordinates/__fixtures__/index.ts"],"names":[],"mappings":";AAeO,IAAM,OAAU,GAAA;AAAA,EACrB,CAAC,WAAW,SAAS,CAAA;AAAA,EACrB,CAAC,6BAA6B,YAAY,CAAA;AAAA,EAC1C,CAAC,sCAAsC,UAAU,CAAA;AAAA,EACjD,CAAC,6BAA6B,YAAY,CAAA;AAAA,EAC1C,CAAC,sCAAsC,UAAU,CAAA;AAAA,EACjD,CAAC,cAAc,wBAAwB,CAAA;AAAA,EACvC,CAAC,iBAAiB,uBAAuB,CAAA;AAAA,EACzC,CAAC,+BAA+B,wBAAwB,CAAA;AAAA,EACxD,CAAC,qBAAqB,kCAA4B,CAAA;AAAA,EAClD,CAAC,eAAe,sBAAsB,CAAA;AAAA,EACtC,CAAC,eAAe,sBAAsB,CAAA;AAAA,EACtC,CAAC,mBAAmB,sBAAsB,CAAA;AAAA,EAC1C,CAAC,0BAA0B,0BAA0B,CAAA;AAAA,EACrD,CAAC,mCAAmC,wBAAwB,CAAA;AAAA,EAC5D,CAAC,0BAA0B,0BAA0B,CAAA;AAAA,EACrD,CAAC,mCAAmC,wBAAwB,CAAA;AAAA,EAC5D,CAAC,mCAAmC,wBAAwB,CAAA;AAAA,EAC5D,CAAC,0BAA0B,gBAAgB,CAAA;AAAA,EAC3C,CAAC,kBAAkB,oCAAoC,CAAA;AACzD,EAAA;AAKO,IAAM,QAAW,GAAA;AAAA,EACtB,CAAC,yBAAyB,cAAc,CAAA;AAAA,EACxC,CAAC,sBAAsB,CAAiB,kBAAA,CAAA,CAAA;AAAA,EACxC,CAAC,4BAA4B,+BAA+B,CAAA;AAAA,EAC5D,CAAC,yBAAyB,CAAqC,yCAAA,CAAA,CAAA;AAAA,EAC/D,CAAC,4BAA4B,iCAAiC,CAAA;AAAA,EAC9D,CAAC,yBAAyB,CAAuC,2CAAA,CAAA,CAAA;AAAA,EACjE,CAAC,eAAe,CAAoC,wCAAA,CAAA,CAAA;AAAA,EACpD,CAAC,eAAe,CAAoC,wCAAA,CAAA,CAAA;AAAA,EACpD,CAAC,mBAAmB,CAAoC,wCAAA,CAAA,CAAA;AAC1D,EAAA;AAEO,IAAM,WAAW,GAAC;AAElB,IAAM,aAAa","file":"index.js","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\n// const LAT_DD = 40.689247;\n// const LON_DD = -74.044502;\n\nexport const ddPairs = [\n ['partial', '40, -74'],\n ['partial directions prefix', 'N 40, W 74'],\n ['partial directions prefix no space', 'N40, W74'],\n ['partial directions suffix', '40 N, 74 W'],\n ['partial directions suffix no space', '40N, 74W'],\n ['plus minus', '+40.689247, -74.044502'],\n ['inferred plus', '40.689247, -74.044502'],\n ['inferred positive direction', '40.689247, 74.044502 W'],\n ['degree delimeters', '40.689247° N, 74.044502° W'],\n ['separator ,', '40.689247,-74.044502'],\n ['separator /', '40.689247/-74.044502'],\n ['separator space', '40.689247 -74.044502'],\n ['NSEW directions prefix', 'N 40.689247, W 74.044502'],\n ['NSEW directions prefix no space', 'N40.689247, W74.044502'],\n ['NSEW directions suffix', '40.689247 N, 74.044502 W'],\n ['NSEW directions suffix no space', '40.689247N, 74.044502W'],\n ['mixed plus minus and directions', '+40.689247, W74.044502'],\n ['mixed full and partial', '40.689247, W74'],\n ['odd whitespace', ' + 40.689247 , - 74.044502 '],\n];\n\n// const LAT_DMS = `40° 41' 21.2892\"`;\n// const LON_DMS = `-74° 02' 40.2066\"`;\n\nexport const dmsPairs = [\n ['partial no delimeters', '40 41 -74 02'],\n ['partial delimeters', `40° 41' -74 02'`],\n ['plus minus no delimeters', '+40 41 21.2892 -74 02 40.2066'],\n ['plus minus delimeters', `+40° 41' 21.2892\" -74° 02' 40.2066\"`],\n ['directions no delimeters', '40 41 21.2892 N 74 02 40.2066 W'],\n ['directions delimeters', `40° 41' 21.2892\" N 74° 02' 40.2066\" W`],\n ['separator ,', `40° 41' 21.2892\",-74° 02' 40.2066\"`],\n ['separator /', `40° 41' 21.2892\"/-74° 02' 40.2066\"`],\n ['separator space', `40° 41' 21.2892\" -74° 02' 40.2066\"`],\n];\n\nexport const ddmPairs = [];\n\nexport const mixedPairs = [];\n"]}
@@ -2,5 +2,7 @@
2
2
  * NOTE: these pairs are setup to support different lon/lat ordering
3
3
  * 0 = latitude first, 1 = longitude first
4
4
  */
5
- export declare const dd: readonly [RegExp, RegExp];
6
- export declare const dms: readonly [RegExp, RegExp];
5
+ declare const dd: readonly [RegExp, RegExp];
6
+ declare const dms: readonly [RegExp, RegExp];
7
+
8
+ export { dd, dms };
@@ -1,15 +1,15 @@
1
- // __private-exports
2
- import { DD_LAT, DD_LON, SEPARATORS, DMS_LAT, DMS_LON } from './regex';
3
- /**
4
- * NOTE: these pairs are setup to support different lon/lat ordering
5
- * 0 = latitude first, 1 = longitude first
6
- */
7
- export const dd = [
8
- new RegExp(DD_LAT + SEPARATORS + DD_LON, 'i'),
9
- new RegExp(DD_LON + SEPARATORS + DD_LAT, 'i'),
1
+ import { DD_LAT, SEPARATORS, DD_LON, DMS_LAT, DMS_LON } from './regex.js';
2
+
3
+ // src/coordinates/configurations.ts
4
+ var dd = [
5
+ new RegExp(DD_LAT + SEPARATORS + DD_LON, "i"),
6
+ new RegExp(DD_LON + SEPARATORS + DD_LAT, "i")
10
7
  ];
11
- export const dms = [
12
- new RegExp(DMS_LAT + SEPARATORS + DMS_LON, 'i'),
13
- new RegExp(DMS_LON + SEPARATORS + DMS_LAT, 'i'),
8
+ var dms = [
9
+ new RegExp(DMS_LAT + SEPARATORS + DMS_LON, "i"),
10
+ new RegExp(DMS_LON + SEPARATORS + DMS_LAT, "i")
14
11
  ];
12
+
13
+ export { dd, dms };
14
+ //# sourceMappingURL=configurations.js.map
15
15
  //# sourceMappingURL=configurations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configurations.js","sourceRoot":"","sources":["../../src/coordinates/configurations.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvE;;;GAGG;AAEH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,GAAG,CAAC;IAC7C,IAAI,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,MAAM,EAAE,GAAG,CAAC;CACrC,CAAC;AAEX,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,GAAG,CAAC;IAC/C,IAAI,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,GAAG,CAAC;CACvC,CAAC"}
1
+ {"version":3,"sources":["../../src/coordinates/configurations.ts"],"names":[],"mappings":";;;AASO,IAAM,EAAK,GAAA;AAAA,EAChB,IAAI,MAAA,CAAO,MAAS,GAAA,UAAA,GAAa,QAAQ,GAAG,CAAA;AAAA,EAC5C,IAAI,MAAA,CAAO,MAAS,GAAA,UAAA,GAAa,QAAQ,GAAG,CAAA;AAC9C,EAAA;AAEO,IAAM,GAAM,GAAA;AAAA,EACjB,IAAI,MAAA,CAAO,OAAU,GAAA,UAAA,GAAa,SAAS,GAAG,CAAA;AAAA,EAC9C,IAAI,MAAA,CAAO,OAAU,GAAA,UAAA,GAAa,SAAS,GAAG,CAAA;AAChD","file":"configurations.js","sourcesContent":["// __private-exports\n\nimport { DD_LAT, DD_LON, SEPARATORS, DMS_LAT, DMS_LON } from './regex';\n\n/**\n * NOTE: these pairs are setup to support different lon/lat ordering\n * 0 = latitude first, 1 = longitude first\n */\n\nexport const dd = [\n new RegExp(DD_LAT + SEPARATORS + DD_LON, 'i'),\n new RegExp(DD_LON + SEPARATORS + DD_LAT, 'i'),\n] as const;\n\nexport const dms = [\n new RegExp(DMS_LAT + SEPARATORS + DMS_LON, 'i'),\n new RegExp(DMS_LON + SEPARATORS + DMS_LAT, 'i'),\n] as const;\n"]}
@@ -1,11 +1,2 @@
1
- /**
2
- * TODOs:
3
- *
4
- * - Auto detect lon/lat ordering?
5
- * - Some tricks we can
6
- * - Regex for NS as first few chars
7
- * - Regex for 3 digits
8
- * - Regex for first digit > 90
9
- */
10
- export { matchDD, matchDMS } from './match';
11
- export { normalizeDD } from './normalize';
1
+ export { matchDD, matchDMS } from './match.js';
2
+ export { normalizeDD } from './normalize.js';
@@ -1,23 +1,4 @@
1
- /*
2
- * Copyright 2024 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
- */
12
- /**
13
- * TODOs:
14
- *
15
- * - Auto detect lon/lat ordering?
16
- * - Some tricks we can
17
- * - Regex for NS as first few chars
18
- * - Regex for 3 digits
19
- * - Regex for first digit > 90
20
- */
21
- export { matchDD, matchDMS } from './match';
22
- export { normalizeDD } from './normalize';
1
+ export { matchDD, matchDMS } from './match.js';
2
+ export { normalizeDD } from './normalize.js';
3
+ //# sourceMappingURL=index.js.map
23
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordinates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -13,7 +13,7 @@ type DDMatches = [
13
13
  Nullish<string>,
14
14
  Nullish<Directions>
15
15
  ];
16
- export declare function matchDD(val: unknown): DDMatches;
16
+ declare function matchDD(val: unknown): DDMatches;
17
17
  type DMSMatches = [
18
18
  Nullish<Directions>,
19
19
  Nullish<PlusMinus>,
@@ -30,5 +30,6 @@ type DMSMatches = [
30
30
  Nullish<string>,
31
31
  Nullish<Directions>
32
32
  ];
33
- export declare function matchDMS(val: unknown): DMSMatches;
34
- export {};
33
+ declare function matchDMS(val: unknown): DMSMatches;
34
+
35
+ export { matchDD, matchDMS };
@@ -1,35 +1,23 @@
1
- /*
2
- * Copyright 2024 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
- */
12
- import { dd, dms } from './configurations';
13
- const ddFallback = Array.from(Array(10), () => '');
14
- // biome-ignore lint/style/useNamingConvention: <explanation>
15
- export function matchDD(val) {
16
- // TODO: lat/lon ordering
17
- const matches = `${val}`.match(dd[0]);
18
- if (!matches) {
19
- return ddFallback;
20
- }
21
- // Remove first regex.match entry since it is the input value
22
- return Array.from(matches).slice(1);
1
+ import { dd, dms } from './configurations.js';
2
+
3
+ // src/coordinates/match.ts
4
+ var ddFallback = Array.from(Array(10), () => "");
5
+ function matchDD(val) {
6
+ const matches = `${val}`.match(dd[0]);
7
+ if (!matches) {
8
+ return ddFallback;
9
+ }
10
+ return Array.from(matches).slice(1);
23
11
  }
24
- const dmsFallback = Array.from(Array(14), () => '');
25
- // biome-ignore lint/style/useNamingConvention: <explanation>
26
- export function matchDMS(val) {
27
- // TODO: lat/lon ordering
28
- const matches = `${val}`.match(dms[0]);
29
- if (!matches) {
30
- return dmsFallback;
31
- }
32
- // Remove first regex.match entry since it is the input value
33
- return Array.from(matches).slice(1);
12
+ var dmsFallback = Array.from(Array(14), () => "");
13
+ function matchDMS(val) {
14
+ const matches = `${val}`.match(dms[0]);
15
+ if (!matches) {
16
+ return dmsFallback;
17
+ }
18
+ return Array.from(matches).slice(1);
34
19
  }
20
+
21
+ export { matchDD, matchDMS };
22
+ //# sourceMappingURL=match.js.map
35
23
  //# sourceMappingURL=match.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"match.js","sourceRoot":"","sources":["../../src/coordinates/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAoB3C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAEnD,6DAA6D;AAC7D,MAAM,UAAU,OAAO,CAAC,GAAY;IAClC,yBAAyB;IAEzB,MAAM,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAuB,CAAC;IACjC,CAAC;IAED,6DAA6D;IAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAc,CAAC;AACnD,CAAC;AAoBD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAEpD,6DAA6D;AAC7D,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,yBAAyB;IAEzB,MAAM,OAAO,GAAG,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,WAAyB,CAAC;IACnC,CAAC;IAED,6DAA6D;IAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAe,CAAC;AACpD,CAAC"}
1
+ {"version":3,"sources":["../../src/coordinates/match.ts"],"names":[],"mappings":";;;AAgCA,IAAM,aAAa,KAAM,CAAA,IAAA,CAAK,MAAM,EAAE,CAAA,EAAG,MAAM,EAAE,CAAA,CAAA;AAG1C,SAAS,QAAQ,GAAyB,EAAA;AAG/C,EAAA,MAAM,UAAU,CAAG,EAAA,GAAG,GAAG,KAAM,CAAA,EAAA,CAAG,CAAC,CAAC,CAAA,CAAA;AAEpC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,OAAA,UAAA,CAAA;AAAA,GACT;AAGA,EAAA,OAAO,KAAM,CAAA,IAAA,CAAK,OAAO,CAAA,CAAE,MAAM,CAAC,CAAA,CAAA;AACpC,CAAA;AAoBA,IAAM,cAAc,KAAM,CAAA,IAAA,CAAK,MAAM,EAAE,CAAA,EAAG,MAAM,EAAE,CAAA,CAAA;AAG3C,SAAS,SAAS,GAA0B,EAAA;AAGjD,EAAA,MAAM,UAAU,CAAG,EAAA,GAAG,GAAG,KAAM,CAAA,GAAA,CAAI,CAAC,CAAC,CAAA,CAAA;AAErC,EAAA,IAAI,CAAC,OAAS,EAAA;AACZ,IAAO,OAAA,WAAA,CAAA;AAAA,GACT;AAGA,EAAA,OAAO,KAAM,CAAA,IAAA,CAAK,OAAO,CAAA,CAAE,MAAM,CAAC,CAAA,CAAA;AACpC","file":"match.js","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 { dd, dms } from './configurations';\n\ntype Nullish<T> = T | undefined | null | '';\ntype PlusMinus = '+' | '-';\ntype Directions = 'N' | 'S' | 'E' | 'W';\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\ntype DDMatches = [\n Nullish<Directions>,\n Nullish<PlusMinus>,\n Nullish<string>, // degrees\n Nullish<string>, // decimals\n Nullish<Directions>,\n Nullish<Directions>,\n Nullish<PlusMinus>,\n Nullish<string>, // degrees\n Nullish<string>, // decimals\n Nullish<Directions>,\n];\n\nconst ddFallback = Array.from(Array(10), () => '');\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\nexport function matchDD(val: unknown): DDMatches {\n // TODO: lat/lon ordering\n\n const matches = `${val}`.match(dd[0]);\n\n if (!matches) {\n return ddFallback as DDMatches;\n }\n\n // Remove first regex.match entry since it is the input value\n return Array.from(matches).slice(1) as DDMatches;\n}\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\ntype DMSMatches = [\n Nullish<Directions>,\n Nullish<PlusMinus>,\n Nullish<string>, // degrees\n Nullish<string>, // minutes\n Nullish<string>, // seconds\n Nullish<string>, // milliarcseconds\n Nullish<Directions>,\n Nullish<Directions>,\n Nullish<PlusMinus>,\n Nullish<string>, // degrees\n Nullish<string>, // minutes\n Nullish<string>, // seconds\n Nullish<string>, // milliarcseconds\n Nullish<Directions>,\n];\n\nconst dmsFallback = Array.from(Array(14), () => '');\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\nexport function matchDMS(val: unknown): DMSMatches {\n // TODO: lat/lon ordering\n\n const matches = `${val}`.match(dms[0]);\n\n if (!matches) {\n return dmsFallback as DMSMatches;\n }\n\n // Remove first regex.match entry since it is the input value\n return Array.from(matches).slice(1) as DMSMatches;\n}\n"]}
@@ -1 +1,3 @@
1
- export declare function normalizeDD(val: string): number[];
1
+ declare function normalizeDD(val: string): number[];
2
+
3
+ export { normalizeDD };
@@ -1,28 +1,27 @@
1
- /*
2
- * Copyright 2024 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
- */
12
1
  import { toDigits } from '@accelint/converters';
13
- import { matchDD } from './match';
14
- import { isPositiveDirection, normalizeDirection, negate } from './utils';
15
- // biome-ignore lint/style/useNamingConvention: <explanation>
16
- export function normalizeDD(val) {
17
- const matches = matchDD(val);
18
- const latDirection = normalizeDirection(matches[0] || matches[4]);
19
- const lonDirection = normalizeDirection(matches[5] || matches[9]);
20
- const latPositive = isPositiveDirection(latDirection, matches[1]);
21
- const lonPositive = isPositiveDirection(lonDirection, matches[6]);
22
- const latParsed = toDigits(Number.parseFloat(`${matches[2]}${matches[3]}`), 6);
23
- const lonParsed = toDigits(Number.parseFloat(`${matches[7]}${matches[8]}`), 6);
24
- const latValue = latPositive ? latParsed : negate(latParsed);
25
- const lonValue = lonPositive ? lonParsed : negate(lonParsed);
26
- return [latValue, lonValue];
2
+ import { matchDD } from './match.js';
3
+ import { normalizeDirection, isPositiveDirection, negate } from './utils.js';
4
+
5
+ // src/coordinates/normalize.ts
6
+ function normalizeDD(val) {
7
+ const matches = matchDD(val);
8
+ const latDirection = normalizeDirection(matches[0] || matches[4]);
9
+ const lonDirection = normalizeDirection(matches[5] || matches[9]);
10
+ const latPositive = isPositiveDirection(latDirection, matches[1]);
11
+ const lonPositive = isPositiveDirection(lonDirection, matches[6]);
12
+ const latParsed = toDigits(
13
+ Number.parseFloat(`${matches[2]}${matches[3]}`),
14
+ 6
15
+ );
16
+ const lonParsed = toDigits(
17
+ Number.parseFloat(`${matches[7]}${matches[8]}`),
18
+ 6
19
+ );
20
+ const latValue = latPositive ? latParsed : negate(latParsed);
21
+ const lonValue = lonPositive ? lonParsed : negate(lonParsed);
22
+ return [latValue, lonValue];
27
23
  }
24
+
25
+ export { normalizeDD };
26
+ //# sourceMappingURL=normalize.js.map
28
27
  //# sourceMappingURL=normalize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/coordinates/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE1E,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAE7B,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,WAAW,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAElE,MAAM,SAAS,GAAG,QAAQ,CACxB,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/C,CAAC,CACF,CAAC;IAEF,MAAM,SAAS,GAAG,QAAQ,CACxB,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/C,CAAC,CACF,CAAC;IAEF,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE7D,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC"}
1
+ {"version":3,"sources":["../../src/coordinates/normalize.ts"],"names":[],"mappings":";;;;;AAiBO,SAAS,YAAY,GAAa,EAAA;AACvC,EAAM,MAAA,OAAA,GAAU,QAAQ,GAAG,CAAA,CAAA;AAE3B,EAAA,MAAM,eAAe,kBAAmB,CAAA,OAAA,CAAQ,CAAC,CAAK,IAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA;AAChE,EAAA,MAAM,eAAe,kBAAmB,CAAA,OAAA,CAAQ,CAAC,CAAK,IAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA;AAChE,EAAA,MAAM,WAAc,GAAA,mBAAA,CAAoB,YAAc,EAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA;AAChE,EAAA,MAAM,WAAc,GAAA,mBAAA,CAAoB,YAAc,EAAA,OAAA,CAAQ,CAAC,CAAC,CAAA,CAAA;AAEhE,EAAA,MAAM,SAAY,GAAA,QAAA;AAAA,IAChB,MAAA,CAAO,UAAW,CAAA,CAAA,EAAG,OAAQ,CAAA,CAAC,CAAC,CAAG,EAAA,OAAA,CAAQ,CAAC,CAAC,CAAE,CAAA,CAAA;AAAA,IAC9C,CAAA;AAAA,GACF,CAAA;AAEA,EAAA,MAAM,SAAY,GAAA,QAAA;AAAA,IAChB,MAAA,CAAO,UAAW,CAAA,CAAA,EAAG,OAAQ,CAAA,CAAC,CAAC,CAAG,EAAA,OAAA,CAAQ,CAAC,CAAC,CAAE,CAAA,CAAA;AAAA,IAC9C,CAAA;AAAA,GACF,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA,WAAA,GAAc,SAAY,GAAA,MAAA,CAAO,SAAS,CAAA,CAAA;AAC3D,EAAA,MAAM,QAAW,GAAA,WAAA,GAAc,SAAY,GAAA,MAAA,CAAO,SAAS,CAAA,CAAA;AAE3D,EAAO,OAAA,CAAC,UAAU,QAAQ,CAAA,CAAA;AAC5B","file":"normalize.js","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 { toDigits } from '@accelint/converters';\nimport { matchDD } from './match';\nimport { isPositiveDirection, normalizeDirection, negate } from './utils';\n\n// biome-ignore lint/style/useNamingConvention: <explanation>\nexport function normalizeDD(val: string) {\n const matches = matchDD(val);\n\n const latDirection = normalizeDirection(matches[0] || matches[4]);\n const lonDirection = normalizeDirection(matches[5] || matches[9]);\n const latPositive = isPositiveDirection(latDirection, matches[1]);\n const lonPositive = isPositiveDirection(lonDirection, matches[6]);\n\n const latParsed = toDigits(\n Number.parseFloat(`${matches[2]}${matches[3]}`),\n 6,\n );\n\n const lonParsed = toDigits(\n Number.parseFloat(`${matches[7]}${matches[8]}`),\n 6,\n );\n\n const latValue = latPositive ? latParsed : negate(latParsed);\n const lonValue = lonPositive ? lonParsed : negate(lonParsed);\n\n return [latValue, lonValue];\n}\n"]}
@@ -1,4 +1,4 @@
1
- export declare const SEPARATORS = "[\\s,\\/]*";
1
+ declare const SEPARATORS = "[\\s,\\/]*";
2
2
  /**
3
3
  * @see https://en.wikipedia.org/wiki/ISO_6709
4
4
  *
@@ -26,7 +26,7 @@ export declare const SEPARATORS = "[\\s,\\/]*";
26
26
  * 075.00417 W
27
27
  * ```
28
28
  */
29
- export declare const DD_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})(\\.\\d*)?[\\s\u00B0]*([NSEW]?)";
29
+ declare const DD_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})(\\.\\d*)?[\\s\u00B0]*([NSEW]?)";
30
30
  /**
31
31
  * @see https://en.wikipedia.org/wiki/ISO_6709
32
32
  *
@@ -53,7 +53,7 @@ export declare const DD_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})(\\.\\d*)?[
53
53
  * 40.20361 N
54
54
  * ```
55
55
  */
56
- export declare const DD_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})(\\.\\d*)?[\\s\u00B0]*([NSEW]?)";
56
+ declare const DD_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})(\\.\\d*)?[\\s\u00B0]*([NSEW]?)";
57
57
  /**
58
58
  * @see https://en.wikipedia.org/wiki/ISO_6709
59
59
  *
@@ -88,7 +88,7 @@ export declare const DD_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})(\\.\\d*)?[
88
88
  * 40 34 56.45 W
89
89
  * ```
90
90
  */
91
- export declare const DMS_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\u00B0'\u2032\"\u2033\\/]*([NSEW]?)";
91
+ declare const DMS_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\u00B0'\u2032\"\u2033\\/]*([NSEW]?)";
92
92
  /**
93
93
  * @see https://en.wikipedia.org/wiki/ISO_6709
94
94
  *
@@ -123,4 +123,6 @@ export declare const DMS_LON = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})[\\s,:\u00
123
123
  * 40 34 56.45 N
124
124
  * ```
125
125
  */
126
- export declare const DMS_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\u00B0'\u2032\"\u2033\\/]*([NSEW]?)";
126
+ declare const DMS_LAT = "([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\d{2})[\\s,:\u00B0'\u2032\"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\u00B0'\u2032\"\u2033\\/]*([NSEW]?)";
127
+
128
+ export { DD_LAT, DD_LON, DMS_LAT, DMS_LON, SEPARATORS };
@@ -1,142 +1,10 @@
1
- // __private-exports
2
- /*
3
- * Copyright 2024 Hypergiant Galactic Systems Inc. All rights reserved.
4
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License. You may obtain a copy
6
- * of the License at https://www.apache.org/licenses/LICENSE-2.0
7
- *
8
- * Unless required by applicable law or agreed to in writing, software distributed under
9
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
10
- * OF ANY KIND, either express or implied. See the License for the specific language
11
- * governing permissions and limitations under the License.
12
- */
13
- // biome-ignore lint/style/noUnusedTemplateLiteral: makes it easier for future modifications
14
- export const SEPARATORS = `[\\s,\\/]*`;
15
- /**
16
- * @see https://en.wikipedia.org/wiki/ISO_6709
17
- *
18
- * Matches common DD format for longitude values.
19
- *
20
- * NSEW ± DDD.D NSEW
21
- *
22
- * Five capture groups:
23
- * 1. Optional NSEW
24
- * 2. Optional +-
25
- * 3. Degrees
26
- * 4. Optional Decimals
27
- * 5. Optional NSEW
28
- *
29
- * @example
30
- * ```markdown
31
- * 75
32
- * 75.00417
33
- * 075.00417
34
- * -075.00417
35
- * - 075.00417
36
- * W075.00417
37
- * 075.00417W
38
- * W 075.00417
39
- * 075.00417 W
40
- * ```
41
- */
42
- // biome-ignore lint/style/noUnusedTemplateLiteral: makes it easier for future modifications
43
- export const DD_LON = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})(\\.\\d*)?[\\s°]*([NSEW]?)`;
44
- /**
45
- * @see https://en.wikipedia.org/wiki/ISO_6709
46
- *
47
- * Matches common DD format for latitude values.
48
- *
49
- * NSEW ± DD.D NSEW
50
- *
51
- * Five capture groups:
52
- * 1. Optional NSEW
53
- * 2. Optional +-
54
- * 3. Degrees
55
- * 4. Optional Decimals
56
- * 5. Optional NSEW
57
- *
58
- * @example
59
- * ```markdown
60
- * 40
61
- * 40.20361
62
- * +40.20361
63
- * + 40.20361
64
- * N40.20361
65
- * 40.20361N
66
- * N 40.20361
67
- * 40.20361 N
68
- * ```
69
- */
70
- // biome-ignore lint/style/noUnusedTemplateLiteral: makes it easier for future modifications
71
- export const DD_LAT = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})(\\.\\d*)?[\\s°]*([NSEW]?)`;
72
- /**
73
- * @see https://en.wikipedia.org/wiki/ISO_6709
74
- *
75
- * Matches common DMS format for longitude values.
76
- *
77
- * Supported delimiters are comma, colon, space, degree, single quote, double quote, and forward slash.
78
- *
79
- * NSEW ± DDD DD DD .D|DDD NSEW
80
- *
81
- * Seven capture groups:
82
- * 1. Optional NSEW
83
- * 2. Optional +-
84
- * 3. Degrees
85
- * 4. Minutes
86
- * 5. Seconds
87
- * 6. Optional decimal seconds or milliarcseconds
88
- * 7. Optional NSEW
89
- *
90
- * @example
91
- * ```markdown
92
- * 403456.45
93
- * 40 34 56.45
94
- * 40/34/56.45
95
- * 40:34:56.45
96
- * 40°34'56.45
97
- * 403456
98
- * 40°34'56"
99
- * +403456.45
100
- * W403456.45
101
- * 403456.45W
102
- * W 40 34 56.45
103
- * 40 34 56.45 W
104
- * ```
105
- */
106
- export const DMS_LON = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})[\\s,:°'′"″\\/]*(\\d{2})[\\s,:°'′"″\\/]*(\\d{2})[\\s,:°'′"″\\/]*(\\.\\d*|\\d{3})?[\\s,:°'′"″\\/]*([NSEW]?)`;
107
- /**
108
- * @see https://en.wikipedia.org/wiki/ISO_6709
109
- *
110
- * Matches common DMS format for latitude values.
111
- *
112
- * Supported delimiters are comma, colon, space, degree, single quote, double quote, and forward slash.
113
- *
114
- * NSEW ± DD DD DD .D|DDD NSEW
115
- *
116
- * Seven capture groups:
117
- * 1. Optional NSEW
118
- * 2. Optional +-
119
- * 3. Degrees
120
- * 4. Minutes
121
- * 5. Seconds
122
- * 6. Optional decimal seconds or milliarcseconds
123
- * 7. Optional NSEW
124
- *
125
- * @example
126
- * ```markdown
127
- * 403456.45
128
- * 40 34 56.45
129
- * 40/34/56.45
130
- * 40:34:56.45
131
- * 40°34'56.45
132
- * 403456
133
- * 40°34'56"
134
- * +403456.45
135
- * N403456.45
136
- * 403456.45N
137
- * N 40 34 56.45
138
- * 40 34 56.45 N
139
- * ```
140
- */
141
- export const DMS_LAT = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})[\\s,:°'′"″\\/]*(\\d{2})[\\s,:°'′"″\\/]*(\\d{2})[\\s,:°'′"″\\/]*(\\.\\d*|\\d{3})?[\\s,:°'′"″\\/]*([NSEW]?)`;
1
+ // src/coordinates/regex.ts
2
+ var SEPARATORS = `[\\s,\\/]*`;
3
+ var DD_LON = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})(\\.\\d*)?[\\s\xB0]*([NSEW]?)`;
4
+ var DD_LAT = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})(\\.\\d*)?[\\s\xB0]*([NSEW]?)`;
5
+ var DMS_LON = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,3})[\\s,:\xB0'\u2032"\u2033\\/]*(\\d{2})[\\s,:\xB0'\u2032"\u2033\\/]*(\\d{2})[\\s,:\xB0'\u2032"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\xB0'\u2032"\u2033\\/]*([NSEW]?)`;
6
+ var DMS_LAT = `([NSEW]?)[\\s]*([-+]?)[\\s]*(\\d{1,2})[\\s,:\xB0'\u2032"\u2033\\/]*(\\d{2})[\\s,:\xB0'\u2032"\u2033\\/]*(\\d{2})[\\s,:\xB0'\u2032"\u2033\\/]*(\\.\\d*|\\d{3})?[\\s,:\xB0'\u2032"\u2033\\/]*([NSEW]?)`;
7
+
8
+ export { DD_LAT, DD_LON, DMS_LAT, DMS_LON, SEPARATORS };
9
+ //# sourceMappingURL=regex.js.map
142
10
  //# sourceMappingURL=regex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"regex.js","sourceRoot":"","sources":["../../src/coordinates/regex.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAEpB;;;;;;;;;;GAUG;AAEH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,kJAAkJ,CAAC;AAE1K;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,kJAAkJ,CAAC"}
1
+ {"version":3,"sources":["../../src/coordinates/regex.ts"],"names":[],"mappings":";AAeO,IAAM,UAAa,GAAA,CAAA,UAAA,EAAA;AA8BnB,IAAM,MAAS,GAAA,CAAA,mEAAA,EAAA;AA6Bf,IAAM,MAAS,GAAA,CAAA,mEAAA,EAAA;AAoCf,IAAM,OAAU,GAAA,CAAA,oMAAA,EAAA;AAoChB,IAAM,OAAU,GAAA,CAAA,oMAAA","file":"regex.js","sourcesContent":["// __private-exports\n\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\n// biome-ignore lint/style/noUnusedTemplateLiteral: makes it easier for future modifications\nexport const SEPARATORS = `[\\\\s,\\\\/]*`;\n\n/**\n * @see https://en.wikipedia.org/wiki/ISO_6709\n *\n * Matches common DD format for longitude values.\n *\n * NSEW ± DDD.D NSEW\n *\n * Five capture groups:\n * 1. Optional NSEW\n * 2. Optional +-\n * 3. Degrees\n * 4. Optional Decimals\n * 5. Optional NSEW\n *\n * @example\n * ```markdown\n * 75\n * 75.00417\n * 075.00417\n * -075.00417\n * - 075.00417\n * W075.00417\n * 075.00417W\n * W 075.00417\n * 075.00417 W\n * ```\n */\n// biome-ignore lint/style/noUnusedTemplateLiteral: makes it easier for future modifications\nexport const DD_LON = `([NSEW]?)[\\\\s]*([-+]?)[\\\\s]*(\\\\d{1,3})(\\\\.\\\\d*)?[\\\\s°]*([NSEW]?)`;\n\n/**\n * @see https://en.wikipedia.org/wiki/ISO_6709\n *\n * Matches common DD format for latitude values.\n *\n * NSEW ± DD.D NSEW\n *\n * Five capture groups:\n * 1. Optional NSEW\n * 2. Optional +-\n * 3. Degrees\n * 4. Optional Decimals\n * 5. Optional NSEW\n *\n * @example\n * ```markdown\n * 40\n * 40.20361\n * +40.20361\n * + 40.20361\n * N40.20361\n * 40.20361N\n * N 40.20361\n * 40.20361 N\n * ```\n */\n// biome-ignore lint/style/noUnusedTemplateLiteral: makes it easier for future modifications\nexport const DD_LAT = `([NSEW]?)[\\\\s]*([-+]?)[\\\\s]*(\\\\d{1,2})(\\\\.\\\\d*)?[\\\\s°]*([NSEW]?)`;\n\n/**\n * @see https://en.wikipedia.org/wiki/ISO_6709\n *\n * Matches common DMS format for longitude values.\n *\n * Supported delimiters are comma, colon, space, degree, single quote, double quote, and forward slash.\n *\n * NSEW ± DDD DD DD .D|DDD NSEW\n *\n * Seven capture groups:\n * 1. Optional NSEW\n * 2. Optional +-\n * 3. Degrees\n * 4. Minutes\n * 5. Seconds\n * 6. Optional decimal seconds or milliarcseconds\n * 7. Optional NSEW\n *\n * @example\n * ```markdown\n * 403456.45\n * 40 34 56.45\n * 40/34/56.45\n * 40:34:56.45\n * 40°34'56.45\n * 403456\n * 40°34'56\"\n * +403456.45\n * W403456.45\n * 403456.45W\n * W 40 34 56.45\n * 40 34 56.45 W\n * ```\n */\nexport const DMS_LON = `([NSEW]?)[\\\\s]*([-+]?)[\\\\s]*(\\\\d{1,3})[\\\\s,:°'′\"″\\\\/]*(\\\\d{2})[\\\\s,:°'′\"″\\\\/]*(\\\\d{2})[\\\\s,:°'′\"″\\\\/]*(\\\\.\\\\d*|\\\\d{3})?[\\\\s,:°'′\"″\\\\/]*([NSEW]?)`;\n\n/**\n * @see https://en.wikipedia.org/wiki/ISO_6709\n *\n * Matches common DMS format for latitude values.\n *\n * Supported delimiters are comma, colon, space, degree, single quote, double quote, and forward slash.\n *\n * NSEW ± DD DD DD .D|DDD NSEW\n *\n * Seven capture groups:\n * 1. Optional NSEW\n * 2. Optional +-\n * 3. Degrees\n * 4. Minutes\n * 5. Seconds\n * 6. Optional decimal seconds or milliarcseconds\n * 7. Optional NSEW\n *\n * @example\n * ```markdown\n * 403456.45\n * 40 34 56.45\n * 40/34/56.45\n * 40:34:56.45\n * 40°34'56.45\n * 403456\n * 40°34'56\"\n * +403456.45\n * N403456.45\n * 403456.45N\n * N 40 34 56.45\n * 40 34 56.45 N\n * ```\n */\nexport const DMS_LAT = `([NSEW]?)[\\\\s]*([-+]?)[\\\\s]*(\\\\d{1,2})[\\\\s,:°'′\"″\\\\/]*(\\\\d{2})[\\\\s,:°'′\"″\\\\/]*(\\\\d{2})[\\\\s,:°'′\"″\\\\/]*(\\\\.\\\\d*|\\\\d{3})?[\\\\s,:°'′\"″\\\\/]*([NSEW]?)`;\n"]}
@@ -1,5 +1,6 @@
1
1
  type Nullish<T> = T | undefined | null | '';
2
- export declare function normalizeDirection(dir: Nullish<string>): 'N' | 'S' | 'E' | 'W' | '';
3
- export declare function negate(val: number): number;
4
- export declare function isPositiveDirection(dir: Nullish<'N' | 'S' | 'E' | 'W'>, sign: Nullish<'+' | '-'>): boolean;
5
- export {};
2
+ declare function normalizeDirection(dir: Nullish<string>): 'N' | 'S' | 'E' | 'W' | '';
3
+ declare function negate(val: number): number;
4
+ declare function isPositiveDirection(dir: Nullish<'N' | 'S' | 'E' | 'W'>, sign: Nullish<'+' | '-'>): boolean;
5
+
6
+ export { isPositiveDirection, negate, normalizeDirection };
@@ -1,27 +1,28 @@
1
- // __private-exports
2
- const supportedDirections = ['N', 'S', 'E', 'W'];
3
- export function normalizeDirection(dir) {
4
- if (!dir) {
5
- return '';
6
- }
7
- const val = dir.toUpperCase();
8
- // Sanity check that the we have a correct direction value
9
- if (!supportedDirections.includes(val)) {
10
- return '';
11
- }
12
- return val;
1
+ // src/coordinates/utils.ts
2
+ var supportedDirections = ["N", "S", "E", "W"];
3
+ function normalizeDirection(dir) {
4
+ if (!dir) {
5
+ return "";
6
+ }
7
+ const val = dir.toUpperCase();
8
+ if (!supportedDirections.includes(val)) {
9
+ return "";
10
+ }
11
+ return val;
13
12
  }
14
- export function negate(val) {
15
- return val * -1;
13
+ function negate(val) {
14
+ return val * -1;
16
15
  }
17
- export function isPositiveDirection(dir, sign) {
18
- if (sign === '-') {
19
- return false;
20
- }
21
- if (dir === 'S' || dir === 'W') {
22
- return false;
23
- }
24
- // A positive direction can be assumed from here
25
- return true;
16
+ function isPositiveDirection(dir, sign) {
17
+ if (sign === "-") {
18
+ return false;
19
+ }
20
+ if (dir === "S" || dir === "W") {
21
+ return false;
22
+ }
23
+ return true;
26
24
  }
25
+
26
+ export { isPositiveDirection, negate, normalizeDirection };
27
+ //# sourceMappingURL=utils.js.map
27
28
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/coordinates/utils.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAgBpB,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAEjD,MAAM,UAAU,kBAAkB,CAChC,GAAoB;IAEpB,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAE9B,0DAA0D;IAC1D,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,GAA4B,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,GAAmC,EACnC,IAAwB;IAExB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gDAAgD;IAChD,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"sources":["../../src/coordinates/utils.ts"],"names":[],"mappings":";AAgBA,IAAM,mBAAsB,GAAA,CAAC,GAAK,EAAA,GAAA,EAAK,KAAK,GAAG,CAAA,CAAA;AAExC,SAAS,mBACd,GAC4B,EAAA;AAC5B,EAAA,IAAI,CAAC,GAAK,EAAA;AACR,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAM,MAAA,GAAA,GAAM,IAAI,WAAY,EAAA,CAAA;AAG5B,EAAA,IAAI,CAAC,mBAAA,CAAoB,QAAS,CAAA,GAAG,CAAG,EAAA;AACtC,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAO,OAAA,GAAA,CAAA;AACT,CAAA;AAEO,SAAS,OAAO,GAAa,EAAA;AAClC,EAAA,OAAO,GAAM,GAAA,CAAA,CAAA,CAAA;AACf,CAAA;AAEO,SAAS,mBAAA,CACd,KACA,IACA,EAAA;AACA,EAAA,IAAI,SAAS,GAAK,EAAA;AAChB,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,GAAA,KAAQ,GAAO,IAAA,GAAA,KAAQ,GAAK,EAAA;AAC9B,IAAO,OAAA,KAAA,CAAA;AAAA,GACT;AAGA,EAAO,OAAA,IAAA,CAAA;AACT","file":"utils.js","sourcesContent":["// __private-exports\n\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\ntype Nullish<T> = T | undefined | null | '';\n\nconst supportedDirections = ['N', 'S', 'E', 'W'];\n\nexport function normalizeDirection(\n dir: Nullish<string>,\n): 'N' | 'S' | 'E' | 'W' | '' {\n if (!dir) {\n return '';\n }\n\n const val = dir.toUpperCase();\n\n // Sanity check that the we have a correct direction value\n if (!supportedDirections.includes(val)) {\n return '';\n }\n\n return val as 'N' | 'S' | 'E' | 'W';\n}\n\nexport function negate(val: number) {\n return val * -1;\n}\n\nexport function isPositiveDirection(\n dir: Nullish<'N' | 'S' | 'E' | 'W'>,\n sign: Nullish<'+' | '-'>,\n) {\n if (sign === '-') {\n return false;\n }\n\n if (dir === 'S' || dir === 'W') {\n return false;\n }\n\n // A positive direction can be assumed from here\n return true;\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,2 @@
1
- /**
2
- * THIS IS A GENERATED FILE. DO NOT ALTER DIRECTLY.
3
- */
4
- export { matchDD, matchDMS } from './coordinates/match';
5
- export { normalizeDD } from './coordinates/normalize';
1
+ export { matchDD, matchDMS } from './coordinates/match.js';
2
+ export { normalizeDD } from './coordinates/normalize.js';
package/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
- /**
2
- * THIS IS A GENERATED FILE. DO NOT ALTER DIRECTLY.
3
- */
4
- export { matchDD, matchDMS } from './coordinates/match';
5
- export { normalizeDD } from './coordinates/normalize';
1
+ export { matchDD, matchDMS } from './coordinates/match.js';
2
+ export { normalizeDD } from './coordinates/normalize.js';
3
+ //# sourceMappingURL=index.js.map
6
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelint/geo",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -9,18 +9,27 @@
9
9
  ],
10
10
  "types": "./dist/index.d.ts",
11
11
  "exports": {
12
- ".": "./dist/index.js"
12
+ ".": {
13
+ "import": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./package.json": "./package.json"
13
20
  },
14
21
  "devDependencies": {
15
22
  "@vitest/coverage-istanbul": "^2.1.3",
23
+ "esbuild-plugin-file-path-extensions": "^2.1.3",
24
+ "tsup": "^8.3.0",
16
25
  "vitest": "^2.1.3",
17
- "@accelint/typescript-config": "0.1.1",
18
- "@accelint/vitest-config": "0.1.1"
26
+ "@accelint/typescript-config": "0.1.2",
27
+ "@accelint/vitest-config": "0.1.2"
19
28
  },
20
29
  "dependencies": {
21
30
  "typescript": "^5.6.3",
22
- "@accelint/converters": "0.1.1",
23
- "@accelint/predicates": "0.1.1"
31
+ "@accelint/converters": "0.1.3",
32
+ "@accelint/predicates": "0.1.3"
24
33
  },
25
34
  "$schema": "https://json.schemastore.org/package",
26
35
  "author": "https://hypergiant.com",
@@ -30,7 +39,7 @@
30
39
  "sideEffects": false,
31
40
  "scripts": {
32
41
  "bench": "pnpm vitest bench --run --dir src",
33
- "build": "pnpm tsc",
42
+ "build": "pnpm tsup",
34
43
  "dev": "pnpm tsc --watch",
35
44
  "index": "pnpm zx ../../scripts/indexer.mjs packages/geo",
36
45
  "lint": "pnpm biome lint ./",