@accelint/geo 0.5.0 → 0.5.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @accelint/geo
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 45275c4: Fixes bug with Decimal Degrees formatting where ordinal degrees redundantly showed negative numbers
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Minor Changes
package/catalog-info.yaml CHANGED
@@ -15,7 +15,7 @@ metadata:
15
15
  annotations:
16
16
  backstage.io/edit-url: https://github.com/gohypergiant/standard-toolkit/blob/main/packages/geo/catalog-info.yaml
17
17
  backstage.io/techdocs-ref: dir:.
18
- package/version: 0.5.0
18
+ package/version: 0.5.1
19
19
  github.com/project-slug: gohypergiant/standard-toolkit
20
20
  links:
21
21
  - url: https://github.com/gohypergiant/standard-toolkit/tree/main/packages/geo
@@ -14,8 +14,8 @@
14
14
  import { createFormatter } from "../internal/format.js";
15
15
 
16
16
  //#region src/coordinates/latlon/decimal-degrees/formatter.ts
17
- const toDecimalDegrees = (num) => {
18
- return `${num.toFixed(6)}°`;
17
+ const toDecimalDegrees = (num, withOrdinal) => {
18
+ return `${(withOrdinal ? Math.abs(num) : num).toFixed(6)}°`;
19
19
  };
20
20
  const formatDecimalDegrees = createFormatter(toDecimalDegrees);
21
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.js","names":[],"sources":["../../../../src/coordinates/latlon/decimal-degrees/formatter.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createFormatter } from '../internal/format';\n\nconst toDecimalDegrees = (num: number): string => {\n return `${num.toFixed(6)}°`;\n};\n\nexport const formatDecimalDegrees = createFormatter(toDecimalDegrees);\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,oBAAoB,QAAwB;AAChD,QAAO,GAAG,IAAI,QAAQ,EAAE,CAAC;;AAG3B,MAAa,uBAAuB,gBAAgB,iBAAiB"}
1
+ {"version":3,"file":"formatter.js","names":[],"sources":["../../../../src/coordinates/latlon/decimal-degrees/formatter.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createFormatter } from '../internal/format';\n\nconst toDecimalDegrees = (num: number, withOrdinal?: boolean): string => {\n const value = withOrdinal ? Math.abs(num) : num;\n return `${value.toFixed(6)}°`;\n};\n\nexport const formatDecimalDegrees = createFormatter(toDecimalDegrees);\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,oBAAoB,KAAa,gBAAkC;AAEvE,QAAO,IADO,cAAc,KAAK,IAAI,IAAI,GAAG,KAC5B,QAAQ,EAAE,CAAC;;AAG7B,MAAa,uBAAuB,gBAAgB,iBAAiB"}
@@ -5,7 +5,7 @@ interface FormatOptions {
5
5
  separator: string;
6
6
  withOrdinal?: boolean;
7
7
  }
8
- declare const createFormatter: (fn: (coord: number) => string) => (coordinates: [number, number], config?: FormatOptions) => string;
8
+ declare const createFormatter: (fn: (coord: number, withOrdinal?: boolean) => string) => (coordinates: [number, number], config?: FormatOptions) => string;
9
9
  //#endregion
10
10
  export { FormatOptions, createFormatter };
11
11
  //# sourceMappingURL=format.d.ts.map
@@ -18,8 +18,8 @@ const createFormatter = (fn) => (coordinates, config) => {
18
18
  const [latitude, longitude] = coordinates;
19
19
  const latOrdinal = `${config?.withOrdinal ? ` ${getOrdinal(latitude, true)}` : ""}`;
20
20
  const lonOrdinal = `${config?.withOrdinal ? ` ${getOrdinal(longitude, false)}` : ""}`;
21
- const lat = fn(latitude);
22
- const lon = fn(longitude);
21
+ const lat = fn(latitude, config?.withOrdinal);
22
+ const lon = fn(longitude, config?.withOrdinal);
23
23
  const prefix = config?.prefix ?? "";
24
24
  const suffix = config?.suffix ?? "";
25
25
  return `${prefix}${lat}${latOrdinal}${config?.separator ?? ", "}${lon}${lonOrdinal}${suffix}`;
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","names":[],"sources":["../../../../src/coordinates/latlon/internal/format.ts"],"sourcesContent":["/*\n * Copyright 2025 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// __private-exports\n\nimport { getOrdinal } from './ordinal';\n\nexport interface FormatOptions {\n prefix: string;\n suffix: string;\n separator: string;\n withOrdinal?: boolean;\n}\n\nexport const createFormatter =\n (fn: (coord: number) => string) =>\n (coordinates: [number, number], config?: FormatOptions): string => {\n const [latitude, longitude] = coordinates;\n const latOrdinal = `${config?.withOrdinal ? ` ${getOrdinal(latitude, true)}` : ''}`;\n const lonOrdinal = `${config?.withOrdinal ? ` ${getOrdinal(longitude, false)}` : ''}`;\n const lat = fn(latitude);\n const lon = fn(longitude);\n const prefix = config?.prefix ?? '';\n const suffix = config?.suffix ?? '';\n const separator = config?.separator ?? ', ';\n\n return `${prefix}${lat}${latOrdinal}${separator}${lon}${lonOrdinal}${suffix}`;\n };\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAa,mBACV,QACA,aAA+B,WAAmC;CACjE,MAAM,CAAC,UAAU,aAAa;CAC9B,MAAM,aAAa,GAAG,QAAQ,cAAc,IAAI,WAAW,UAAU,KAAK,KAAK;CAC/E,MAAM,aAAa,GAAG,QAAQ,cAAc,IAAI,WAAW,WAAW,MAAM,KAAK;CACjF,MAAM,MAAM,GAAG,SAAS;CACxB,MAAM,MAAM,GAAG,UAAU;CACzB,MAAM,SAAS,QAAQ,UAAU;CACjC,MAAM,SAAS,QAAQ,UAAU;AAGjC,QAAO,GAAG,SAAS,MAAM,aAFP,QAAQ,aAAa,OAEW,MAAM,aAAa"}
1
+ {"version":3,"file":"format.js","names":[],"sources":["../../../../src/coordinates/latlon/internal/format.ts"],"sourcesContent":["/*\n * Copyright 2025 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// __private-exports\n\nimport { getOrdinal } from './ordinal';\n\nexport interface FormatOptions {\n prefix: string;\n suffix: string;\n separator: string;\n withOrdinal?: boolean;\n}\n\nexport const createFormatter =\n (fn: (coord: number, withOrdinal?: boolean) => string) =>\n (coordinates: [number, number], config?: FormatOptions): string => {\n const [latitude, longitude] = coordinates;\n const latOrdinal = `${config?.withOrdinal ? ` ${getOrdinal(latitude, true)}` : ''}`;\n const lonOrdinal = `${config?.withOrdinal ? ` ${getOrdinal(longitude, false)}` : ''}`;\n const lat = fn(latitude, config?.withOrdinal);\n const lon = fn(longitude, config?.withOrdinal);\n const prefix = config?.prefix ?? '';\n const suffix = config?.suffix ?? '';\n const separator = config?.separator ?? ', ';\n\n return `${prefix}${lat}${latOrdinal}${separator}${lon}${lonOrdinal}${suffix}`;\n };\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAa,mBACV,QACA,aAA+B,WAAmC;CACjE,MAAM,CAAC,UAAU,aAAa;CAC9B,MAAM,aAAa,GAAG,QAAQ,cAAc,IAAI,WAAW,UAAU,KAAK,KAAK;CAC/E,MAAM,aAAa,GAAG,QAAQ,cAAc,IAAI,WAAW,WAAW,MAAM,KAAK;CACjF,MAAM,MAAM,GAAG,UAAU,QAAQ,YAAY;CAC7C,MAAM,MAAM,GAAG,WAAW,QAAQ,YAAY;CAC9C,MAAM,SAAS,QAAQ,UAAU;CACjC,MAAM,SAAS,QAAQ,UAAU;AAGjC,QAAO,GAAG,SAAS,MAAM,aAFP,QAAQ,aAAa,OAEW,MAAM,aAAa"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@accelint/geo",
3
3
  "description": "A collection of JavaScript functions for working with coordinates and geospatial data.",
4
- "version": "0.5.0",
4
+ "version": "0.5.1",
5
5
  "author": "https://hypergiant.com",
6
6
  "$schema": "https://json.schemastore.org/package",
7
7
  "dependencies": {