exiftool-vendored 29.0.0 → 29.2.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 +33 -9
- package/README.md +22 -22
- 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 +16 -5
- package/dist/BinaryExtractionTask.js.map +1 -1
- package/dist/BinaryField.js.map +1 -1
- 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 +27 -6
- package/dist/CoordinateParser.js +128 -27
- package/dist/CoordinateParser.js.map +1 -1
- package/dist/DateTime.d.ts +1 -1
- package/dist/DateTime.js.map +1 -1
- package/dist/DefaultCreateDateTagNames.js.map +1 -1
- package/dist/DefaultExifToolOptions.js +22 -7
- package/dist/DefaultExifToolOptions.js.map +1 -1
- package/dist/DefaultExiftoolArgs.js.map +1 -1
- package/dist/DefaultMaxProcs.js +26 -8
- 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 +9 -0
- package/dist/ErrorsAndWarnings.js.map +1 -1
- package/dist/ExifDate.js.map +1 -1
- package/dist/ExifDateTime.d.ts +2 -2
- package/dist/ExifDateTime.js +4 -5
- package/dist/ExifDateTime.js.map +1 -1
- package/dist/ExifTime.js.map +1 -1
- package/dist/ExifTool.d.ts +27 -21
- package/dist/ExifTool.js +49 -32
- 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 +17 -7
- package/dist/ExifToolTask.js.map +1 -1
- package/dist/ExifToolVendoredTags.js.map +1 -1
- package/dist/ExiftoolPath.js +21 -9
- 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.map +1 -1
- package/dist/GPS.d.ts +6 -12
- package/dist/GPS.js +83 -119
- package/dist/GPS.js.map +1 -1
- 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 +5 -3
- package/dist/Number.js +10 -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 +17 -7
- package/dist/ReadRawTask.js.map +1 -1
- package/dist/ReadTask.d.ts +1 -1
- package/dist/ReadTask.js +55 -21
- 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 +17 -7
- package/dist/RewriteAllTagsTask.js.map +1 -1
- package/dist/Sidecars.js.map +1 -1
- package/dist/String.d.ts +2 -2
- package/dist/String.js +0 -3
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js.map +1 -1
- package/dist/Tags.d.ts +161 -159
- package/dist/TimeParsing.js.map +1 -1
- package/dist/Times.js.map +1 -1
- package/dist/Timezones.d.ts +5 -4
- package/dist/Timezones.js +53 -18
- 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.map +1 -1
- package/dist/Which.js.map +1 -1
- package/dist/WriteTags.d.ts +6 -1
- package/dist/WriteTask.js +36 -13
- package/dist/WriteTask.js.map +1 -1
- package/eslint.config.mjs +34 -0
- package/package.json +22 -20
package/CHANGELOG.md
CHANGED
|
@@ -25,12 +25,36 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
25
25
|
|
|
26
26
|
## Version history
|
|
27
27
|
|
|
28
|
+
### v29.2.0
|
|
29
|
+
|
|
30
|
+
- 🌱 Upgraded ExifTool to version [13.25](https://exiftool.org/history.html#13.25).
|
|
31
|
+
|
|
32
|
+
- ✨ [ExifTool.write](https://photostructure.github.io/exiftool-vendored.js/classes/ExifTool.html#write) now supports `boolean` field values. Thanks for the [suggestion](https://github.com/photostructure/exiftool-vendored.js/issues/228), [Kira-Kitsune](https://github.com/Kira-Kitsune).
|
|
33
|
+
|
|
34
|
+
- 📦 Updated the default for [maxProcs](https://photostructure.github.io/exiftool-vendored.js/interfaces/ExifToolOptions.html#maxprocs) to use [availableParallelism](https://nodejs.org/api/os.html#osavailableparallelism) where available.
|
|
35
|
+
|
|
36
|
+
### v29.1.0
|
|
37
|
+
|
|
38
|
+
- 🌱 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.
|
|
39
|
+
|
|
40
|
+
- ✨ Thanks to [Mert](https://github.com/mertalev) for [adding forceWrite to binary tag extraction](https://github.com/photostructure/exiftool-vendored.js/pull/222).
|
|
41
|
+
|
|
42
|
+
- ✨ 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).
|
|
43
|
+
|
|
44
|
+
- 🐞 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)!
|
|
45
|
+
|
|
46
|
+
- 📦 Updated to the latest `eslint`, which required rewriting the config, and delinting the new nits
|
|
47
|
+
|
|
48
|
+
- 📦 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.
|
|
49
|
+
|
|
28
50
|
### v29.0.0
|
|
29
51
|
|
|
30
52
|
- 💔/🐞/📦 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.
|
|
31
53
|
|
|
32
54
|
- 📦 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`.
|
|
33
55
|
|
|
56
|
+
- 💔 TypeScript now emits ES2022, which requires Node.js 18.
|
|
57
|
+
|
|
34
58
|
#### GPS improvements
|
|
35
59
|
|
|
36
60
|
- 🐞/📦 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.
|
|
@@ -173,7 +197,7 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
173
197
|
|
|
174
198
|
### v25.0.0
|
|
175
199
|
|
|
176
|
-
- 🌱/✨ ExifTool upgraded to [v12.80](https://exiftool.org/history.html#v12.80), which **adds support for reverse-geo lookups** and [several other geolocation features](https://exiftool.org/geolocation.html
|
|
200
|
+
- 🌱/✨ ExifTool upgraded to [v12.80](https://exiftool.org/history.html#v12.80), which **adds support for reverse-geo lookups** and [several other geolocation features](https://exiftool.org/geolocation.html)
|
|
177
201
|
|
|
178
202
|
- ✨ If no vendored version of `exiftool` is available, we'll try to make do with whatever is available in the `PATH`.
|
|
179
203
|
|
|
@@ -489,11 +513,11 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
489
513
|
- ✨ Add support for alternative gps timezone lookup libraries. If you want to use `geo-tz` instead, use something like this:
|
|
490
514
|
|
|
491
515
|
```js
|
|
492
|
-
const geoTz = require("geo-tz")
|
|
493
|
-
const { ExifTool } = require("exiftool-vendored")
|
|
516
|
+
const geoTz = require("geo-tz");
|
|
517
|
+
const { ExifTool } = require("exiftool-vendored");
|
|
494
518
|
const exiftool = new ExifTool({
|
|
495
519
|
geoToTz: (lat, lon) => geoTz.find(lat, lon)[0],
|
|
496
|
-
})
|
|
520
|
+
});
|
|
497
521
|
```
|
|
498
522
|
|
|
499
523
|
- ✨ 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`).
|
|
@@ -1025,7 +1049,7 @@ const exiftool = new ExifTool({
|
|
|
1025
1049
|
|
|
1026
1050
|
### v9.1.0
|
|
1027
1051
|
|
|
1028
|
-
- ✨
|
|
1052
|
+
- ✨ Added `ExifTool.deleteAllTags`.
|
|
1029
1053
|
|
|
1030
1054
|
### v9.0.0
|
|
1031
1055
|
|
|
@@ -1396,7 +1420,7 @@ most users won't be affected, unless you've been waiting for this feature!)
|
|
|
1396
1420
|
|
|
1397
1421
|
### v6.0.0
|
|
1398
1422
|
|
|
1399
|
-
- 💔 `ExifTool`'s many constructor parameters turned out to be quite
|
|
1423
|
+
- 💔 `ExifTool`'s many constructor parameters turned out to be quite unwieldy.
|
|
1400
1424
|
Version 6's [constructor](https://photostructure.github.io/exiftool-vendored.js/classes/exiftool.html#constructor) now takes an [options
|
|
1401
1425
|
hash](https://photostructure.github.io/exiftool-vendored.js/interfaces/exiftooloptions.html).
|
|
1402
1426
|
If you used the defaults, those haven't changed, and your code won't need to
|
|
@@ -1455,7 +1479,7 @@ most users won't be affected, unless you've been waiting for this feature!)
|
|
|
1455
1479
|
- 🌱 ExifTool upgraded to
|
|
1456
1480
|
[v11.02](https://exiftool.org/history.html#v11.02).
|
|
1457
1481
|
- 📦 taskRetries default is now 1, which should allow recovery of the rare
|
|
1458
|
-
RPC/fork error, but actual corrupt files and
|
|
1482
|
+
RPC/fork error, but actual corrupt files and real errors can be rejected
|
|
1459
1483
|
sooner.
|
|
1460
1484
|
- 📦 Pull in latest dependencies, include new batch-cluster.
|
|
1461
1485
|
|
|
@@ -1575,7 +1599,7 @@ most users won't be affected, unless you've been waiting for this feature!)
|
|
|
1575
1599
|
|
|
1576
1600
|
- 🌱 ExifTool upgraded to
|
|
1577
1601
|
[v10.70](https://exiftool.org/history.html#v10.70)
|
|
1578
|
-
- 📦 Replace tslint and tsfmt with prettier
|
|
1602
|
+
- 📦 Replace `tslint` and `tsfmt` with `prettier`
|
|
1579
1603
|
- 📦 Add test coverage report
|
|
1580
1604
|
|
|
1581
1605
|
(due to buggy interactions between `yarn` and `np`, v4.13.0 was published in
|
|
@@ -1628,7 +1652,7 @@ an incomplete state and subsequently unpublished)
|
|
|
1628
1652
|
- 🌱 ExifTool upgraded to
|
|
1629
1653
|
[v10.66](https://exiftool.org/history.html#v10.66)
|
|
1630
1654
|
- ✨ Pull in new `batch-cluster` with more aggressive child process management
|
|
1631
|
-
(uses `taskkill` on win32 platforms and `kill -9` on
|
|
1655
|
+
(uses `taskkill` on win32 platforms and `kill -9` on unix-ish platforms)
|
|
1632
1656
|
- ✨ ExifTool constructor defaults were relaxed to handle slow NAS
|
|
1633
1657
|
- ✨ Upgraded to Mocha 4.0. Added calls to `exiftool.end()` in test `after`
|
|
1634
1658
|
blocks and the README so `--exit` isn't necessary.
|
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/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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AC;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,24 @@ 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
|
-
|
|
29
|
+
// Capital W allows destination files to not have a pattern. See
|
|
30
|
+
// https://exiftool.org/exiftool_pod.html#W-FMT--tagOut
|
|
31
|
+
//
|
|
32
|
+
// Prior code used -w with %0f "to avoid shell expansion", but as this
|
|
33
|
+
// command gets sent directly to exiftool thanks to stay_open mode, we
|
|
34
|
+
// don't need to worry about shell expansion.
|
|
35
|
+
//
|
|
36
|
+
// I also tried `-out` instead of `-W`, and that didn't work at least on
|
|
37
|
+
// ExifTool 13.17.
|
|
38
|
+
forceWrite ? "-W!" : "-W",
|
|
39
|
+
node_path_1.default.resolve(imgDest),
|
|
29
40
|
node_path_1.default.resolve(imgSrc),
|
|
30
41
|
];
|
|
31
42
|
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,gEAAgE;YAChE,uDAAuD;YACvD,EAAE;YACF,sEAAsE;YACtE,sEAAsE;YACtE,6CAA6C;YAC7C,EAAE;YACF,wEAAwE;YACxE,kBAAkB;YAClB,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;AAlDD,oDAkDC"}
|
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"}
|
|
@@ -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,EAA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ACvD,CAAC;CACF;AA5CD,gDA4CC;AAED,MAAM,SAAS,GAAG,SAAS,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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { Maybe } from "./Maybe";
|
|
1
2
|
type Direction = "N" | "S" | "E" | "W";
|
|
2
3
|
type CoordinateFormat = "DMS" | "DM" | "D";
|
|
3
4
|
interface Coordinate {
|
|
5
|
+
decimal: number;
|
|
4
6
|
degrees: number;
|
|
5
7
|
minutes: number | undefined;
|
|
6
8
|
seconds: number | undefined;
|
|
@@ -8,16 +10,17 @@ interface Coordinate {
|
|
|
8
10
|
format: CoordinateFormat;
|
|
9
11
|
remainder: string | undefined;
|
|
10
12
|
}
|
|
13
|
+
export interface CoordinateResult {
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* Parses a string containing both latitude and longitude coordinates.
|
|
13
19
|
* @param input - String containing both coordinates
|
|
14
20
|
* @returns Object containing latitude and longitude in decimal degrees, or undefined if parsing fails
|
|
15
21
|
* @throws CoordinateParseError if the input format is invalid
|
|
16
22
|
*/
|
|
17
|
-
export declare function parseCoordinates(input: string):
|
|
18
|
-
latitude: number;
|
|
19
|
-
longitude: number;
|
|
20
|
-
};
|
|
23
|
+
export declare function parseCoordinates(input: string): CoordinateResult;
|
|
21
24
|
/**
|
|
22
25
|
* Parses a coordinate string in decimal degrees format.
|
|
23
26
|
* @param input - String containing a single coordinate
|
|
@@ -25,14 +28,32 @@ export declare function parseCoordinates(input: string): {
|
|
|
25
28
|
* @throws CoordinateParseError if the format is not decimal degrees or direction is missing
|
|
26
29
|
*/
|
|
27
30
|
export declare function parseDecimalCoordinate(input: string): {
|
|
28
|
-
|
|
31
|
+
decimal: number;
|
|
29
32
|
direction: Direction;
|
|
30
33
|
} | undefined;
|
|
31
34
|
/**
|
|
32
35
|
* Parses a single coordinate string into its components.
|
|
33
36
|
* @param input - String containing a single coordinate
|
|
37
|
+
* @param expectRemainders - If true, allow additional text after the coordinate
|
|
34
38
|
* @returns Parsed coordinate object
|
|
35
39
|
* @throws CoordinateParseError if the format is invalid
|
|
36
40
|
*/
|
|
37
|
-
export declare function parseCoordinate(input: string): Coordinate;
|
|
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
|
+
};
|
|
38
59
|
export {};
|