exiftool-vendored 28.8.0 → 29.1.0
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 +40 -4
- package/README.md +22 -22
- package/SECURITY.md +1 -2
- package/dist/Array.d.ts +4 -4
- package/dist/Array.js +8 -10
- package/dist/Array.js.map +1 -1
- package/dist/AsyncRetry.js.map +1 -1
- package/dist/BinaryExtractionTask.d.ts +4 -2
- package/dist/BinaryExtractionTask.js +8 -5
- package/dist/BinaryExtractionTask.js.map +1 -1
- package/dist/BinaryField.js +2 -0
- package/dist/BinaryField.js.map +1 -1
- package/dist/BinaryToBufferTask.js +5 -5
- package/dist/BinaryToBufferTask.js.map +1 -1
- package/dist/Boolean.d.ts +1 -1
- package/dist/Boolean.js.map +1 -1
- package/dist/CapturedAtTagNames.js.map +1 -1
- package/dist/CoordinateParser.d.ts +59 -0
- package/dist/CoordinateParser.js +286 -0
- package/dist/CoordinateParser.js.map +1 -0
- package/dist/DateTime.d.ts +1 -1
- package/dist/DateTime.js +4 -5
- package/dist/DateTime.js.map +1 -1
- package/dist/DefaultCreateDateTagNames.js.map +1 -1
- package/dist/DefaultExifToolOptions.js +20 -7
- package/dist/DefaultExifToolOptions.js.map +1 -1
- package/dist/DefaultExiftoolArgs.js.map +1 -1
- package/dist/DefaultMaxProcs.js +17 -7
- package/dist/DefaultMaxProcs.js.map +1 -1
- package/dist/DeleteAllTagsArgs.js.map +1 -1
- package/dist/ErrorsAndWarnings.d.ts +5 -1
- package/dist/ErrorsAndWarnings.js +11 -2
- package/dist/ErrorsAndWarnings.js.map +1 -1
- package/dist/ExifDate.js +7 -2
- package/dist/ExifDate.js.map +1 -1
- package/dist/ExifDateTime.d.ts +2 -2
- package/dist/ExifDateTime.js +63 -67
- package/dist/ExifDateTime.js.map +1 -1
- package/dist/ExifTime.js +19 -26
- package/dist/ExifTime.js.map +1 -1
- package/dist/ExifTool.d.ts +28 -24
- package/dist/ExifTool.js +97 -81
- package/dist/ExifTool.js.map +1 -1
- package/dist/ExifToolOptions.d.ts +8 -0
- package/dist/ExifToolOptions.js.map +1 -1
- package/dist/ExifToolTags.js +0 -1
- package/dist/ExifToolTags.js.map +1 -1
- package/dist/ExifToolTask.js +38 -33
- package/dist/ExifToolTask.js.map +1 -1
- package/dist/ExifToolVendoredTags.js.map +1 -1
- package/dist/ExiftoolPath.js +27 -12
- package/dist/ExiftoolPath.js.map +1 -1
- package/dist/File.d.ts +2 -0
- package/dist/File.js +16 -1
- package/dist/File.js.map +1 -1
- package/dist/FileTags.d.ts +3 -2
- package/dist/FileTags.js +3 -2
- package/dist/FileTags.js.map +1 -1
- package/dist/FilenameCharsetArgs.js.map +1 -1
- package/dist/FirstDateTime.js +1 -1
- package/dist/FirstDateTime.js.map +1 -1
- package/dist/GPS.d.ts +18 -0
- package/dist/GPS.js +116 -0
- package/dist/GPS.js.map +1 -0
- package/dist/GeoTz.js.map +1 -1
- package/dist/GeolocationTags.d.ts +1 -1
- package/dist/GeolocationTags.js +16 -14
- package/dist/GeolocationTags.js.map +1 -1
- package/dist/IsWarning.js.map +1 -1
- package/dist/IsWin32.js +17 -7
- package/dist/IsWin32.js.map +1 -1
- package/dist/JSON.js +4 -1
- package/dist/JSON.js.map +1 -1
- package/dist/Lazy.js +2 -1
- package/dist/Lazy.js.map +1 -1
- package/dist/Maybe.js.map +1 -1
- package/dist/Number.d.ts +18 -3
- package/dist/Number.js +36 -1
- package/dist/Number.js.map +1 -1
- package/dist/Object.d.ts +4 -4
- package/dist/Object.js +8 -8
- package/dist/Object.js.map +1 -1
- package/dist/OnlyZerosRE.js.map +1 -1
- package/dist/Pick.js.map +1 -1
- package/dist/ReadRawTask.js +20 -8
- package/dist/ReadRawTask.js.map +1 -1
- package/dist/ReadTask.d.ts +1 -1
- package/dist/ReadTask.js +233 -264
- package/dist/ReadTask.js.map +1 -1
- package/dist/ResourceEvent.d.ts +1 -1
- package/dist/ResourceEvent.js +1 -1
- package/dist/ResourceEvent.js.map +1 -1
- package/dist/RewriteAllTagsTask.js +19 -9
- package/dist/RewriteAllTagsTask.js.map +1 -1
- package/dist/Sidecars.js.map +1 -1
- package/dist/String.d.ts +8 -4
- package/dist/String.js +7 -3
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js +1 -2
- package/dist/Struct.js.map +1 -1
- package/dist/Tags.d.ts +154 -152
- package/dist/TimeParsing.js +6 -8
- package/dist/TimeParsing.js.map +1 -1
- package/dist/Times.d.ts +6 -0
- package/dist/Times.js +7 -3
- package/dist/Times.js.map +1 -1
- package/dist/Timezones.d.ts +5 -4
- package/dist/Timezones.js +71 -41
- package/dist/Timezones.js.map +1 -1
- package/dist/Version.d.ts +1 -1
- package/dist/Version.js +1 -1
- package/dist/Version.js.map +1 -1
- package/dist/VersionTask.js +1 -1
- package/dist/VersionTask.js.map +1 -1
- package/dist/Which.js.map +1 -1
- package/dist/WriteTags.d.ts +6 -1
- package/dist/WriteTask.js +71 -25
- package/dist/WriteTask.js.map +1 -1
- package/eslint.config.mjs +34 -0
- package/package.json +21 -19
package/CHANGELOG.md
CHANGED
|
@@ -25,13 +25,49 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
25
25
|
|
|
26
26
|
## Version history
|
|
27
27
|
|
|
28
|
+
### v29.1.0
|
|
29
|
+
|
|
30
|
+
- 🌱 Upgraded ExifTool to version [13.17](https://exiftool.org/history.html#13.17). Note that this release includes **seventeen** ExifTool version bumps (from November 2024 through January 2025--Phil Harvey has been _busy_!). Although I haven't seen any breaking changes in the Tags generation or test suite with the new versions, please do your own validation.
|
|
31
|
+
|
|
32
|
+
- ✨ Thanks to [Mert](https://github.com/mertalev) for [adding forceWrite to binary tag extraction](https://github.com/photostructure/exiftool-vendored.js/pull/222).
|
|
33
|
+
|
|
34
|
+
- ✨ ExifTool's Geolocation feature seems to work around some obscure GPS encoding issues where the decimal sign gets ignored. This project now leverages that "corrected" GPS location by adopting the hemisphere signs, which seems to [fix this issue](https://github.com/immich-app/immich/issues/13053).
|
|
35
|
+
|
|
36
|
+
- 🐞 Removed `OffsetTime` from the list of Timezone offset tags we infer tz from. Thanks for the [heads-up](https://github.com/photostructure/exiftool-vendored.js/issues/220), [Carsten Otto](https://github.com/C-Otto)!
|
|
37
|
+
|
|
38
|
+
- 📦 Updated to the latest `eslint`, which required rewriting the config, and delinting the new nits
|
|
39
|
+
|
|
40
|
+
- 📦 Deleted most of the `prettier` config to accept their defaults. This created a huge [no-op commit](https://github.com/photostructure/exiftool-vendored.js/commit/622e8a814e22697c25efeb911215855753a97892) but now it's over.
|
|
41
|
+
|
|
42
|
+
### v29.0.0
|
|
43
|
+
|
|
44
|
+
- 💔/🐞/📦 ExifTool sometimes returns `boolean` values for some tags, like `SemanticStylePreset`, but uses "Yes" or "No" values for other tags, like `GPSValid` (TIL!). If the tag name ends in `Valid` and is truthy (1, true, "Yes") or falsy (0, false, "No"), we'll convert it to a boolean for you. Note that this is arguably a breaking API change, but it should be what you were already expecting (so is it a bug fix?). See the diff to the Tags interface in this version to verify what types have changed.
|
|
45
|
+
|
|
46
|
+
- 📦 Reduced `streamFlushMillis` to `10`. This reduced elapsed time for the full test suite by 2.5x on macOS and 3x on Windows, and drops the upper latency bound substantially. Note that this is at the risk of buffered stream collisions between tasks. The (extensive) test suite on Github Actions (whose virtual machines are notoriously slower than molasses) still runs solidly, but if you see internal errors, please open a Github issue and increase your `streamFlushMillis`.
|
|
47
|
+
|
|
48
|
+
- 💔 TypeScript now emits ES2022, which requires Node.js 18.
|
|
49
|
+
|
|
50
|
+
#### GPS improvements
|
|
51
|
+
|
|
52
|
+
- 🐞/📦 GPS Latitude and GPS Longitude values are now parsed from [DMS notation](<https://en.wikipedia.org/wiki/Degree_(angle)#Subdivisions>), which seems to avoid some incorrectly signed values in some file formats (especially for some problematic XMP exports, like from Apple Photos). Numeric GPSLatitude and GPSLongitude are still accepted: to avoid the new coordinates parsing code, restore `GPSLatitude` and `GPSLongitude` to the `ExifToolOptions.numericTags` array.
|
|
53
|
+
|
|
54
|
+
- 🐞/📦 If `ExifToolOptions.geolocation` is enabled, and `GeolocationPosition` exists, and we got numeric GPS coordinates, we will assume the hemisphere from GeolocationPosition, as that tag seems to correct for more conditions than GPS\*Ref values.
|
|
55
|
+
|
|
56
|
+
- 🐞/📦 If the encoded GPS location is invalid, all `GPS*` and `Geolocation*` metadata will be omitted from `ExifTool.readTags()`. Prior versions let some values (like `GPSCoordinates`) from invalid values slip by. A location is invalid if latitude and longitude are 0, out of bounds, either are unspecified.
|
|
57
|
+
|
|
58
|
+
- 🐞/📦 Reading and writing GPS latitude and GPS longitude values is surprisingly tricky, and could fail for some file formats due to inconsistent handling of negative values. Now, within `ExifTool.writeTags()`, we will automatically set `GPSLatitudeRef` and `GPSLongitudeRef` if lat/lon are provided but references are unspecified. More tests were added to verify this workaround. On reads, `GPSLatitudeRef` and `GPSLongitudeRef` will be backfilled to be correct. Note that they only return `"N" | "S" | "E" | "W"` now, rather than possibly being the full cardinal direction name.
|
|
59
|
+
|
|
60
|
+
- 🐞 If `ignoreZeroZeroLatLon` and `geolocation` were `true`, (0,0) location timezones could still be inferred in prior versions.
|
|
61
|
+
|
|
62
|
+
- 📦 GPS coordinates are now round to 6 decimal places (≈11cm precision). This exceeds consumer GPS accuracy while simplifying test assertions and reducing noise in comparisons. Previously storing full float precision added complexity without practical benefit.
|
|
63
|
+
|
|
28
64
|
### v28.8.0
|
|
29
65
|
|
|
30
66
|
**Important:** ExifTool versions use the format `NN.NN` and do not follow semantic versioning. The version from ExifTool will not parse correctly with the `semver` library (for the next 10 versions) since they are zero- padded.
|
|
31
67
|
|
|
32
68
|
- 🌱 Upgraded ExifTool to version [13.00](https://exiftool.org/history.html#13.00)
|
|
33
69
|
|
|
34
|
-
|
|
70
|
+
**Note:** ExifTool version numbers increment by 0.01 and do not follow semantic versioning conventions. The changes between version 12.99 and 13.00 are minor updates without any known breaking changes.
|
|
35
71
|
|
|
36
72
|
- 📦 Added Node.js v23 to the build matrix.
|
|
37
73
|
|
|
@@ -469,11 +505,11 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
469
505
|
- ✨ Add support for alternative gps timezone lookup libraries. If you want to use `geo-tz` instead, use something like this:
|
|
470
506
|
|
|
471
507
|
```js
|
|
472
|
-
const geoTz = require("geo-tz")
|
|
473
|
-
const { ExifTool } = require("exiftool-vendored")
|
|
508
|
+
const geoTz = require("geo-tz");
|
|
509
|
+
const { ExifTool } = require("exiftool-vendored");
|
|
474
510
|
const exiftool = new ExifTool({
|
|
475
511
|
geoToTz: (lat, lon) => geoTz.find(lat, lon)[0],
|
|
476
|
-
})
|
|
512
|
+
});
|
|
477
513
|
```
|
|
478
514
|
|
|
479
515
|
- ✨ If a timezone offset tag is present, _and_ GPS metadata can infer a timezone, _and_ they result in the same offset, `Tags.tz` will use the GPS zone name (like `America/Los_Angeles`).
|
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ string array, and things should "just work" **for the main process**.
|
|
|
77
77
|
|
|
78
78
|
```ts
|
|
79
79
|
"./node_modules/exiftool-vendored." +
|
|
80
|
-
(process.platform === "win32" ? "exe" : "pl")
|
|
80
|
+
(process.platform === "win32" ? "exe" : "pl");
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
**If your main process forks any node subprocesses, `process.resourcesPath` _will
|
|
@@ -135,12 +135,12 @@ it.
|
|
|
135
135
|
|
|
136
136
|
```js
|
|
137
137
|
// We're using the singleton here for convenience:
|
|
138
|
-
const exiftool = require("exiftool-vendored").exiftool
|
|
138
|
+
const exiftool = require("exiftool-vendored").exiftool;
|
|
139
139
|
|
|
140
140
|
// And to verify everything is working:
|
|
141
141
|
exiftool
|
|
142
142
|
.version()
|
|
143
|
-
.then((version) => console.log(`We're running ExifTool v${version}`))
|
|
143
|
+
.then((version) => console.log(`We're running ExifTool v${version}`));
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
If the default [ExifTool constructor
|
|
@@ -148,8 +148,8 @@ parameters](https://photostructure.github.io/exiftool-vendored.js/interfaces/Exi
|
|
|
148
148
|
wont' work for you, it's just a class that takes an options hash:
|
|
149
149
|
|
|
150
150
|
```js
|
|
151
|
-
const ExifTool = require("exiftool-vendored").ExifTool
|
|
152
|
-
const exiftool = new ExifTool({ taskTimeoutMillis: 5000 })
|
|
151
|
+
const ExifTool = require("exiftool-vendored").ExifTool;
|
|
152
|
+
const exiftool = new ExifTool({ taskTimeoutMillis: 5000 });
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
You should only use the exported default `exiftool` singleton, or only create one instance of `ExifTool` as a singleton.
|
|
@@ -220,10 +220,10 @@ exiftool
|
|
|
220
220
|
.read("path/to/image.jpg")
|
|
221
221
|
.then((tags /*: Tags */) =>
|
|
222
222
|
console.log(
|
|
223
|
-
`Make: ${tags.Make}, Model: ${tags.Model}, Errors: ${tags.errors}
|
|
224
|
-
)
|
|
223
|
+
`Make: ${tags.Make}, Model: ${tags.Model}, Errors: ${tags.errors}`,
|
|
224
|
+
),
|
|
225
225
|
)
|
|
226
|
-
.catch((err) => console.error("Something terrible happened: ", err))
|
|
226
|
+
.catch((err) => console.error("Something terrible happened: ", err));
|
|
227
227
|
```
|
|
228
228
|
|
|
229
229
|
### Extracting embedded images
|
|
@@ -233,19 +233,19 @@ Extract the low-resolution thumbnail in `path/to/image.jpg`, write it to
|
|
|
233
233
|
when the image is extracted:
|
|
234
234
|
|
|
235
235
|
```js
|
|
236
|
-
exiftool.extractThumbnail("path/to/image.jpg", "path/to/thumbnail.jpg")
|
|
236
|
+
exiftool.extractThumbnail("path/to/image.jpg", "path/to/thumbnail.jpg");
|
|
237
237
|
```
|
|
238
238
|
|
|
239
239
|
Extract the `Preview` image (only found in some images):
|
|
240
240
|
|
|
241
241
|
```js
|
|
242
|
-
exiftool.extractPreview("path/to/image.jpg", "path/to/preview.jpg")
|
|
242
|
+
exiftool.extractPreview("path/to/image.jpg", "path/to/preview.jpg");
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
Extract the `JpgFromRaw` image (found in some RAW images):
|
|
246
246
|
|
|
247
247
|
```js
|
|
248
|
-
exiftool.extractJpgFromRaw("path/to/image.cr2", "path/to/fromRaw.jpg")
|
|
248
|
+
exiftool.extractJpgFromRaw("path/to/image.cr2", "path/to/fromRaw.jpg");
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
Extract the binary value from "tagname" tag in `path/to/image.jpg`
|
|
@@ -253,7 +253,7 @@ and write it to `dest.bin` (which cannot exist already
|
|
|
253
253
|
and whose parent directory must already exist):
|
|
254
254
|
|
|
255
255
|
```js
|
|
256
|
-
exiftool.extractBinaryTag("tagname", "path/to/file.exf", "path/to/dest.bin")
|
|
256
|
+
exiftool.extractBinaryTag("tagname", "path/to/file.exf", "path/to/dest.bin");
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
### Writing tags
|
|
@@ -271,7 +271,7 @@ To write a comment to the given file so it shows up in the Windows Explorer
|
|
|
271
271
|
Properties panel:
|
|
272
272
|
|
|
273
273
|
```js
|
|
274
|
-
exiftool.write("path/to/file.jpg", { XPComment: "this is a test comment" })
|
|
274
|
+
exiftool.write("path/to/file.jpg", { XPComment: "this is a test comment" });
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
To change the DateTimeOriginal, CreateDate and ModifyDate tags (using the
|
|
@@ -279,7 +279,7 @@ To change the DateTimeOriginal, CreateDate and ModifyDate tags (using the
|
|
|
279
279
|
shortcut) to 4:56pm UTC on February 6, 2016:
|
|
280
280
|
|
|
281
281
|
```js
|
|
282
|
-
exiftool.write("path/to/file.jpg", { AllDates: "2016-02-06T16:56:00" })
|
|
282
|
+
exiftool.write("path/to/file.jpg", { AllDates: "2016-02-06T16:56:00" });
|
|
283
283
|
```
|
|
284
284
|
|
|
285
285
|
To write to a specific metadata group's tag, just prefix the tag name with the group.
|
|
@@ -288,13 +288,13 @@ To write to a specific metadata group's tag, just prefix the tag name with the g
|
|
|
288
288
|
```js
|
|
289
289
|
exiftool.write("path/to/file.jpg", {
|
|
290
290
|
"IPTC:CopyrightNotice": "© 2021 PhotoStructure, Inc.",
|
|
291
|
-
})
|
|
291
|
+
});
|
|
292
292
|
```
|
|
293
293
|
|
|
294
294
|
To delete a tag, use `null` as the value.
|
|
295
295
|
|
|
296
296
|
```js
|
|
297
|
-
exiftool.write("path/to/file.jpg", { UserComment: null })
|
|
297
|
+
exiftool.write("path/to/file.jpg", { UserComment: null });
|
|
298
298
|
```
|
|
299
299
|
|
|
300
300
|
The above example removes any value associated with the `UserComment` tag.
|
|
@@ -322,7 +322,7 @@ details about this functionality.
|
|
|
322
322
|
errors.
|
|
323
323
|
|
|
324
324
|
```js
|
|
325
|
-
exiftool.rewriteAllTags("problematic.jpg", "rewritten.jpg")
|
|
325
|
+
exiftool.rewriteAllTags("problematic.jpg", "rewritten.jpg");
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
### ExifTool configuration support (`.ExifTool_config`)
|
|
@@ -365,7 +365,7 @@ and can be solved by adding an `after` block that shuts down the instance
|
|
|
365
365
|
of ExifTool that your tests are using:
|
|
366
366
|
|
|
367
367
|
```js
|
|
368
|
-
after(() => exiftool.end()) // assuming your singleton is called `exiftool`
|
|
368
|
+
after(() => exiftool.end()); // assuming your singleton is called `exiftool`
|
|
369
369
|
```
|
|
370
370
|
|
|
371
371
|
## Dates
|
|
@@ -447,15 +447,15 @@ The `Tags` object returned by `ExifTool.read()` can be serialized to JSON with `
|
|
|
447
447
|
To reconstitute, use the `parseJSON()` method.
|
|
448
448
|
|
|
449
449
|
```ts
|
|
450
|
-
import { exiftool, parseJSON } from "exiftool-vendored"
|
|
450
|
+
import { exiftool, parseJSON } from "exiftool-vendored";
|
|
451
451
|
|
|
452
|
-
const tags: Tags = await exiftool.read("/path/to/file.jpg")
|
|
453
|
-
const str: string = JSON.stringify(tags)
|
|
452
|
+
const tags: Tags = await exiftool.read("/path/to/file.jpg");
|
|
453
|
+
const str: string = JSON.stringify(tags);
|
|
454
454
|
|
|
455
455
|
// parseJSON doesn't validate the input, so we don't assert that it's a Tags
|
|
456
456
|
// instance, but you can cast it (unsafely...)
|
|
457
457
|
|
|
458
|
-
const tags2: Tags = parseJSON(str) as Tags
|
|
458
|
+
const tags2: Tags = parseJSON(str) as Tags;
|
|
459
459
|
```
|
|
460
460
|
|
|
461
461
|
## Performance
|
package/SECURITY.md
CHANGED
|
@@ -10,8 +10,7 @@ If you find a vulnerability, _or even think you have_, please send an email to
|
|
|
10
10
|
the author. Each signed git release by `mceachen` contains a monitored email
|
|
11
11
|
address.
|
|
12
12
|
|
|
13
|
-
If you prefer, you may DM
|
|
14
|
-
[@PhotoStructure](https://twitter.com/PhotoStructure).
|
|
13
|
+
If you prefer, you may [DM @mrm on the PhotoStructure forum](https://forum.photostructure.com/new-message?username=mrm&title=Security+concern).
|
|
15
14
|
|
|
16
15
|
Expect a reply in under 36 hours. Please try an alternative contact method if
|
|
17
16
|
you don't get a response.
|
package/dist/Array.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Maybe, MaybeNull } from "./Maybe";
|
|
2
|
-
export declare function isIterable(obj:
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
2
|
+
export declare function isIterable(obj: unknown): obj is Iterable<unknown>;
|
|
3
|
+
export declare function ifArray<T = unknown>(arr: T[] | unknown): Maybe<T[]>;
|
|
4
|
+
export declare function toArray<T>(arr: undefined | null | T[] | T | Iterable<T>): T[];
|
|
5
5
|
export declare function compact<T>(array: MaybeNull<T>[]): T[];
|
|
6
6
|
/**
|
|
7
7
|
* Remove all elements from the given array that return false from the given
|
|
@@ -9,7 +9,7 @@ export declare function compact<T>(array: MaybeNull<T>[]): T[];
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function filterInPlace<T>(arr: T[], filter: (t: T) => boolean): T[];
|
|
11
11
|
export declare function uniq<T>(arr: T[]): T[];
|
|
12
|
-
export declare function shallowArrayEql(a:
|
|
12
|
+
export declare function shallowArrayEql(a: unknown[], b: unknown[]): boolean;
|
|
13
13
|
type Comparable = number | string | boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Returns a copy of arr, stable sorted by the given constraint. Note that false
|
package/dist/Array.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isIterable = isIterable;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
4
|
+
exports.ifArray = ifArray;
|
|
5
|
+
exports.toArray = toArray;
|
|
6
6
|
exports.compact = compact;
|
|
7
7
|
exports.filterInPlace = filterInPlace;
|
|
8
8
|
exports.uniq = uniq;
|
|
9
9
|
exports.shallowArrayEql = shallowArrayEql;
|
|
10
10
|
exports.sortBy = sortBy;
|
|
11
11
|
exports.leastBy = leastBy;
|
|
12
|
+
const Object_1 = require("./Object");
|
|
12
13
|
const String_1 = require("./String");
|
|
13
14
|
function isIterable(obj) {
|
|
14
|
-
return (obj
|
|
15
|
-
typeof obj !== "string" &&
|
|
16
|
-
typeof obj[Symbol.iterator] === "function");
|
|
15
|
+
return ((0, Object_1.isObject)(obj) && Symbol.iterator in obj) || Array.isArray(obj);
|
|
17
16
|
}
|
|
18
|
-
function
|
|
17
|
+
function ifArray(arr) {
|
|
19
18
|
return Array.isArray(arr) ? arr : undefined;
|
|
20
19
|
}
|
|
21
|
-
function
|
|
20
|
+
function toArray(arr) {
|
|
22
21
|
return Array.isArray(arr) // < strings are not arrays
|
|
23
22
|
? arr
|
|
24
23
|
: arr == null
|
|
@@ -70,15 +69,14 @@ function shallowArrayEql(a, b) {
|
|
|
70
69
|
* Note: localeSort() thinks lower case should come before upper case (!!)
|
|
71
70
|
*/
|
|
72
71
|
function sortBy(arr, f) {
|
|
73
|
-
return (
|
|
72
|
+
return toArray(arr).filter((ea) => ea != null)
|
|
74
73
|
.map((item) => ({
|
|
75
74
|
item,
|
|
76
75
|
cmp: f(item),
|
|
77
76
|
}))
|
|
78
77
|
.filter((ea) => ea.cmp != null)
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
80
78
|
.sort((a, b) => cmp(a.cmp, b.cmp))
|
|
81
|
-
.map((ea) => ea.item)
|
|
79
|
+
.map((ea) => ea.item);
|
|
82
80
|
}
|
|
83
81
|
function cmp(a, b) {
|
|
84
82
|
// undefined == undefined:
|
package/dist/Array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Array.js","sourceRoot":"","sources":["../src/Array.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Array.js","sourceRoot":"","sources":["../src/Array.ts"],"names":[],"mappings":";;AAIA,gCAEC;AAED,0BAEC;AAED,0BAUC;AAED,0BAEC;AAMD,sCAUC;AAED,oBAKC;AAGD,0CAOC;AAWD,wBAYC;AAwBD,0BAcC;AAvHD,qCAAoC;AACpC,qCAAoC;AAEpC,SAAgB,UAAU,CAAC,GAAY;IACrC,OAAO,CAAC,IAAA,iBAAQ,EAAC,GAAG,CAAC,IAAI,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,OAAO,CAAc,GAAkB;IACrD,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9C,CAAC;AAED,SAAgB,OAAO,CAAI,GAA6C;IACtE,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,2BAA2B;QACnD,CAAC,CAAE,GAAW;QACd,CAAC,CAAC,GAAG,IAAI,IAAI;YACX,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,IAAA,iBAAQ,EAAC,GAAG,CAAC,CAAC,+CAA+C;gBAC7D,CAAC,CAAC,CAAC,GAAQ,CAAC;gBACZ,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;oBAC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,CAAC;IAC5C,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAgB,OAAO,CACrB,QAAa,EACb,CAA8B;IAE9B,IAAI,GAAsB,CAAC;IAC3B,IAAI,MAAgB,CAAC;IACrB,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;QAClB,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC;YAC9C,GAAG,GAAG,GAAG,CAAC;YACV,MAAM,GAAG,EAAE,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,MAAO,CAAC;AACjB,CAAC"}
|
package/dist/AsyncRetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsyncRetry.js","sourceRoot":"","sources":["../src/AsyncRetry.ts"],"names":[],"mappings":";;AAAA,sCAkBC;AAlBD,SAAgB,aAAa,CAC3B,CAAuB,EACvB,UAAkB;IAElB,IAAI,OAAO,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"AsyncRetry.js","sourceRoot":"","sources":["../src/AsyncRetry.ts"],"names":[],"mappings":";;AAAA,sCAkBC;AAlBD,SAAgB,aAAa,CAC3B,CAAuB,EACvB,UAAkB;IAElB,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,CAAC,GAAqB,KAAK,IAAI,EAAE;QACrC,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,EAAE,CAAC;QACnB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;gBACzB,OAAO,EAAE,CAAC;gBACV,OAAO,CAAC,EAAE,CAAC;YACb,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC;AACb,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExifToolOptions } from "./ExifToolOptions";
|
|
2
|
+
import { ExifToolTask } from "./ExifToolTask";
|
|
2
3
|
import { Maybe } from "./Maybe";
|
|
4
|
+
export type BinaryExtractionTaskOptions = Pick<ExifToolOptions, "ignoreMinorErrors"> & Partial<Pick<ExifToolOptions, "forceWrite">>;
|
|
3
5
|
/**
|
|
4
6
|
* Task that returns an error string (to prevent retries), or undefined if
|
|
5
7
|
* everything seems to have worked.
|
|
6
8
|
*/
|
|
7
9
|
export declare class BinaryExtractionTask extends ExifToolTask<Maybe<string>> {
|
|
8
10
|
private constructor();
|
|
9
|
-
static for(tagname: string, imgSrc: string, imgDest: string, options?:
|
|
11
|
+
static for(tagname: string, imgSrc: string, imgDest: string, options?: BinaryExtractionTaskOptions): BinaryExtractionTask;
|
|
10
12
|
parse(stdout: string, err?: Error): Maybe<string>;
|
|
11
13
|
}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.BinaryExtractionTask = void 0;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
7
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
9
|
const ExifToolTask_1 = require("./ExifToolTask");
|
|
9
10
|
const FilenameCharsetArgs_1 = require("./FilenameCharsetArgs");
|
|
@@ -18,14 +19,16 @@ class BinaryExtractionTask extends ExifToolTask_1.ExifToolTask {
|
|
|
18
19
|
super(args, options);
|
|
19
20
|
}
|
|
20
21
|
static for(tagname, imgSrc, imgDest, options) {
|
|
22
|
+
// Ensure the destination directory exists:
|
|
23
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.dirname(imgDest), { recursive: true });
|
|
24
|
+
const forceWrite = options?.forceWrite ?? false;
|
|
21
25
|
const args = [
|
|
22
26
|
...FilenameCharsetArgs_1.Utf8FilenameCharsetArgs,
|
|
23
|
-
"-b",
|
|
27
|
+
"-b", // -binary
|
|
24
28
|
"-" + tagname,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"%0f" + node_path_1.default.resolve(imgDest),
|
|
29
|
+
// capital W allows destination files to not have a pattern:
|
|
30
|
+
forceWrite ? "-W!" : "-W",
|
|
31
|
+
node_path_1.default.resolve(imgDest),
|
|
29
32
|
node_path_1.default.resolve(imgSrc),
|
|
30
33
|
];
|
|
31
34
|
return new BinaryExtractionTask(args, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryExtractionTask.js","sourceRoot":"","sources":["../src/BinaryExtractionTask.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"BinaryExtractionTask.js","sourceRoot":"","sources":["../src/BinaryExtractionTask.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAoC;AACpC,0DAA6B;AAE7B,iDAA8C;AAC9C,+DAAgE;AAEhE,qCAA+B;AAQ/B,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AAElD;;;GAGG;AACH,MAAa,oBAAqB,SAAQ,2BAA2B;IACnE,YAAoB,IAAc,EAAE,OAAqC;QACvE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,GAAG,CACR,OAAe,EACf,MAAc,EACd,OAAe,EACf,OAAqC;QAErC,2CAA2C;QAC3C,IAAA,mBAAS,EAAC,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEtD,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,KAAK,CAAC;QAEhD,MAAM,IAAI,GAAG;YACX,GAAG,6CAAuB;YAC1B,IAAI,EAAE,UAAU;YAChB,GAAG,GAAG,OAAO;YACb,4DAA4D;YAC5D,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YACzB,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YACrB,mBAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SACrB,CAAC;QACF,OAAO,IAAI,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,MAAc,EAAE,GAAW;QAC/B,MAAM,CAAC,GAAG,IAAA,YAAG,EAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YAChB,MAAM,GAAG,CAAC;QACZ,CAAC;aAAM,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,uCAAuC,GAAG,MAAM,GAAG,GAAG,CAAC,CAAC;QAC1E,CAAC;aAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;aAAM,CAAC;YACN,2EAA2E;YAC3E,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;CACF;AA1CD,oDA0CC"}
|
package/dist/BinaryField.js
CHANGED
package/dist/BinaryField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryField.js","sourceRoot":"","sources":["../src/BinaryField.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"BinaryField.js","sourceRoot":"","sources":["../src/BinaryField.ts"],"names":[],"mappings":";;;AACA,qCAAiC;AAEjC,0DAA0D;AAC1D,MAAM,aAAa;AACjB,2EAA2E;AAC3E,+DAA+D;AAC/D,qCAAqC;AACrC,oCAAoC,CAAC;AAEvC,MAAa,WAAW;IAEX;IACA;IAFX,YACW,KAAa,EACb,QAAgB;QADhB,UAAK,GAAL,KAAK,CAAQ;QACb,aAAQ,GAAR,QAAQ,CAAQ;IACxB,CAAC;IAEJ,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,aAAa;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAuC;QACrD,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,QAAgB;QAClC,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACd,MAAM,KAAK,GAAG,IAAA,cAAK,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,OAAO;IACT,CAAC;CACF;AA5BD,kCA4BC"}
|
|
@@ -13,6 +13,7 @@ const String_1 = require("./String");
|
|
|
13
13
|
* everything seems to have worked.
|
|
14
14
|
*/
|
|
15
15
|
class BinaryToBufferTask extends ExifToolTask_1.ExifToolTask {
|
|
16
|
+
tagname;
|
|
16
17
|
constructor(tagname, args, options) {
|
|
17
18
|
super(args, options);
|
|
18
19
|
this.tagname = tagname;
|
|
@@ -25,9 +26,8 @@ class BinaryToBufferTask extends ExifToolTask_1.ExifToolTask {
|
|
|
25
26
|
return new BinaryToBufferTask(tagname, args, options);
|
|
26
27
|
}
|
|
27
28
|
parse(data, err) {
|
|
28
|
-
var _a;
|
|
29
29
|
try {
|
|
30
|
-
const obj =
|
|
30
|
+
const obj = JSON.parse(data)?.[0];
|
|
31
31
|
// did they get the casing right?
|
|
32
32
|
{
|
|
33
33
|
const result = decode(obj[this.tagname]);
|
|
@@ -43,13 +43,13 @@ class BinaryToBufferTask extends ExifToolTask_1.ExifToolTask {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
catch (caught) {
|
|
46
|
-
err
|
|
46
|
+
err ??= (0, String_1.notBlank)(data)
|
|
47
47
|
? new Error(data)
|
|
48
48
|
: caught instanceof Error
|
|
49
49
|
? caught
|
|
50
|
-
: new Error(String(caught))
|
|
50
|
+
: new Error(String(caught));
|
|
51
51
|
}
|
|
52
|
-
return err
|
|
52
|
+
return err ?? new Error(this.tagname + " not found");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
exports.BinaryToBufferTask = BinaryToBufferTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BinaryToBufferTask.js","sourceRoot":"","sources":["../src/BinaryToBufferTask.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"BinaryToBufferTask.js","sourceRoot":"","sources":["../src/BinaryToBufferTask.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B;AAC7B,iDAAmE;AACnE,+DAAgE;AAEhE,qCAAoC;AAEpC;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,2BAA4B;IAEvD;IADX,YACW,OAAe,EACxB,IAAc,EACd,OAA6B;QAE7B,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAJZ,YAAO,GAAP,OAAO,CAAQ;IAK1B,CAAC;IAED,MAAM,CAAC,GAAG,CACR,OAAe,EACf,MAAc,EACd,OAA6B;QAE7B,sEAAsE;QACtE,wCAAwC;QACxC,MAAM,IAAI,GAAG,CAAC,GAAG,6CAAuB,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,IAAI,CAA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CAAC;AAE5B,SAAS,MAAM,CAAC,IAAmB;IACjC,OAAO,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAChD,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/Boolean.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Maybe } from "./Maybe";
|
|
2
|
-
export declare function toBoolean(value:
|
|
2
|
+
export declare function toBoolean(value: unknown): Maybe<boolean>;
|
package/dist/Boolean.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Boolean.js","sourceRoot":"","sources":["../src/Boolean.ts"],"names":[],"mappings":";;AAKA,8BAKC;AARD,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"Boolean.js","sourceRoot":"","sources":["../src/Boolean.ts"],"names":[],"mappings":";;AAKA,8BAKC;AARD,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;AAC1C,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE1C,SAAgB,SAAS,CAAC,KAAc;IACtC,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IACpC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7C,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7C,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CapturedAtTagNames.js","sourceRoot":"","sources":["../src/CapturedAtTagNames.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAG;IAChC,wBAAwB;IACxB,kBAAkB;IAClB,uBAAuB;IACvB,kBAAkB;IAClB,YAAY;IACZ,iBAAiB;IACjB,cAAc,EAAE,0CAA0C;IAC1D,iBAAiB;IACjB,aAAa,EAAE,0BAA0B;CACC,
|
|
1
|
+
{"version":3,"file":"CapturedAtTagNames.js","sourceRoot":"","sources":["../src/CapturedAtTagNames.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAG;IAChC,wBAAwB;IACxB,kBAAkB;IAClB,uBAAuB;IACvB,kBAAkB;IAClB,YAAY;IACZ,iBAAiB;IACjB,cAAc,EAAE,0CAA0C;IAC1D,iBAAiB;IACjB,aAAa,EAAE,0BAA0B;CACC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Maybe } from "./Maybe";
|
|
2
|
+
type Direction = "N" | "S" | "E" | "W";
|
|
3
|
+
type CoordinateFormat = "DMS" | "DM" | "D";
|
|
4
|
+
interface Coordinate {
|
|
5
|
+
decimal: number;
|
|
6
|
+
degrees: number;
|
|
7
|
+
minutes: number | undefined;
|
|
8
|
+
seconds: number | undefined;
|
|
9
|
+
direction: Direction | undefined;
|
|
10
|
+
format: CoordinateFormat;
|
|
11
|
+
remainder: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface CoordinateResult {
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Parses a string containing both latitude and longitude coordinates.
|
|
19
|
+
* @param input - String containing both coordinates
|
|
20
|
+
* @returns Object containing latitude and longitude in decimal degrees, or undefined if parsing fails
|
|
21
|
+
* @throws CoordinateParseError if the input format is invalid
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseCoordinates(input: string): CoordinateResult;
|
|
24
|
+
/**
|
|
25
|
+
* Parses a coordinate string in decimal degrees format.
|
|
26
|
+
* @param input - String containing a single coordinate
|
|
27
|
+
* @returns Object containing degrees and direction, or undefined if parsing fails
|
|
28
|
+
* @throws CoordinateParseError if the format is not decimal degrees or direction is missing
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseDecimalCoordinate(input: string): {
|
|
31
|
+
decimal: number;
|
|
32
|
+
direction: Direction;
|
|
33
|
+
} | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Parses a single coordinate string into its components.
|
|
36
|
+
* @param input - String containing a single coordinate
|
|
37
|
+
* @param expectRemainders - If true, allow additional text after the coordinate
|
|
38
|
+
* @returns Parsed coordinate object
|
|
39
|
+
* @throws CoordinateParseError if the format is invalid
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseCoordinate(input: string, expectRemainders?: boolean): Coordinate;
|
|
42
|
+
export type CoordinateType = "Latitude" | "Longitude";
|
|
43
|
+
export interface CoordinateConfig {
|
|
44
|
+
value: number;
|
|
45
|
+
ref: string | undefined;
|
|
46
|
+
geoValue: number | undefined;
|
|
47
|
+
expectedRefPositive: "N" | "E";
|
|
48
|
+
expectedRefNegative: "S" | "W";
|
|
49
|
+
max: 90 | 180;
|
|
50
|
+
coordinateType: CoordinateType;
|
|
51
|
+
}
|
|
52
|
+
export declare function roundGpsDecimal(decimal: number): number;
|
|
53
|
+
export declare function parsePosition(position: Maybe<string>): Maybe<[number, number]>;
|
|
54
|
+
export declare function processCoordinate(config: CoordinateConfig, warnings: string[]): {
|
|
55
|
+
value: number;
|
|
56
|
+
ref: string;
|
|
57
|
+
isInvalid: boolean;
|
|
58
|
+
};
|
|
59
|
+
export {};
|