exiftool-vendored 30.1.0 → 30.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 +10 -8
- package/dist/StrEnum.d.ts +144 -4
- package/dist/StrEnum.js +2 -0
- package/dist/StrEnum.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -27,6 +27,14 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
27
27
|
|
|
28
28
|
### v30.2.0
|
|
29
29
|
|
|
30
|
+
- ✨ Enhanced `StrEnum` with iterator support and JSDoc
|
|
31
|
+
|
|
32
|
+
### v30.1.0
|
|
33
|
+
|
|
34
|
+
- 🌱 Upgraded ExifTool to version [13.30](https://exiftool.org/history.html#13.30).
|
|
35
|
+
|
|
36
|
+
- 🐞 Fixed `ExifToolVersion` to be a `string`. Prior versions used `exiftool`'s JSON representation, which rendered a numeric float. This caused versions like "12.3" and "12.30" to appear identical. We now preserve the exact version string to enable proper version comparisons.
|
|
37
|
+
|
|
30
38
|
- ✨ Added **partial date support** for `ExifDate` class. XMP date tags (like `XMP:CreateDate`, `XMP:MetadataDate`) now support:
|
|
31
39
|
|
|
32
40
|
- **Year-only dates**: `1980` (numeric) or `"1980"` (string)
|
|
@@ -51,18 +59,12 @@ vendored versions of ExifTool match the version that they vendor.
|
|
|
51
59
|
- `"XMP:CreateDate"`, `"XMP:MetadataDate"`, etc. accept partial dates
|
|
52
60
|
- `"EXIF:CreateDate"`, etc. require full dates (type-safe distinction)
|
|
53
61
|
|
|
62
|
+
- 📦 Docs are now automatically updated via [GitHub Actions](https://github.com/photostructure/exiftool-vendored.js/actions/workflows/docs.yml)
|
|
63
|
+
|
|
54
64
|
- 📦 Added comprehensive test coverage (47 new tests) for partial date functionality
|
|
55
65
|
|
|
56
66
|
- 📦 Upgrade to batch-cluster [v14.0.0](https://github.com/photostructure/batch-cluster.js/releases/tag/v14.0.0) which removes the requirement for `procps` on most linux distributions.
|
|
57
67
|
|
|
58
|
-
### v30.1.0
|
|
59
|
-
|
|
60
|
-
- 🌱 Upgraded ExifTool to version [13.30](https://exiftool.org/history.html#13.30).
|
|
61
|
-
|
|
62
|
-
- 🐞 Fixed `ExifToolVersion` to be a `string`. Prior versions used `exiftool`'s JSON representation, which rendered a numeric float. This caused versions like "12.3" and "12.30" to appear identical. We now preserve the exact version string to enable proper version comparisons.
|
|
63
|
-
|
|
64
|
-
- 📦 Docs are now automatically updated via [GitHub Actions](https://github.com/photostructure/exiftool-vendored.js/actions/workflows/docs.yml)
|
|
65
|
-
|
|
66
68
|
### v30.0.0
|
|
67
69
|
|
|
68
70
|
- 💔 Dropped support for Node v18, whose End-of-Life was 2025-04-30.
|
package/dist/StrEnum.d.ts
CHANGED
|
@@ -2,31 +2,171 @@ import { Maybe, Nullable } from "./Maybe";
|
|
|
2
2
|
export type StrEnumType<T extends string> = {
|
|
3
3
|
[K in T]: K;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Helper methods and properties for string enum types created with {@link strEnum}.
|
|
7
|
+
*
|
|
8
|
+
* Provides type-safe utilities for working with predefined string literal types,
|
|
9
|
+
* including validation, comparison, and transformation operations.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The union of string literals that make up this enum
|
|
12
|
+
*/
|
|
5
13
|
export type StrEnumHelpers<T extends string> = {
|
|
14
|
+
/** Array of all valid enum values in declaration order */
|
|
6
15
|
values: T[];
|
|
16
|
+
/** Number of enum values */
|
|
7
17
|
length: number;
|
|
8
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Synonym for {@link includes}. Checks if a string is a valid enum value.
|
|
20
|
+
* @param s - String to check (can be null/undefined)
|
|
21
|
+
* @returns Type predicate indicating if s is a valid enum value
|
|
22
|
+
*/
|
|
9
23
|
has(s: Nullable<string>): s is T;
|
|
24
|
+
/**
|
|
25
|
+
* Type-safe check if a string is a valid enum value (case-sensitive).
|
|
26
|
+
* @param s - String to check (can be null/undefined)
|
|
27
|
+
* @returns Type predicate indicating if s is a valid enum value
|
|
28
|
+
* @example
|
|
29
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
30
|
+
* Colors.includes("red") // true
|
|
31
|
+
* Colors.includes("RED") // false
|
|
32
|
+
*/
|
|
10
33
|
includes(s: Nullable<string>): s is T;
|
|
34
|
+
/**
|
|
35
|
+
* Get enum value with case-insensitive matching.
|
|
36
|
+
* @param s - String to match (can be null/undefined)
|
|
37
|
+
* @returns Matching enum value or undefined if no match
|
|
38
|
+
* @example
|
|
39
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
40
|
+
* Colors.getCI("RED") // "red"
|
|
41
|
+
* Colors.getCI("purple") // undefined
|
|
42
|
+
*/
|
|
11
43
|
getCI(s: Nullable<string>): Maybe<T>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new array containing only the specified enum values.
|
|
46
|
+
* @param t - Enum values to include
|
|
47
|
+
* @returns Array of specified enum values
|
|
48
|
+
* @example
|
|
49
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
50
|
+
* Colors.pick("red", "blue") // ["red", "blue"]
|
|
51
|
+
*/
|
|
12
52
|
pick<O extends T>(...t: O[]): Extract<T, O>[];
|
|
53
|
+
/**
|
|
54
|
+
* Create a new array containing all enum values except the specified ones.
|
|
55
|
+
* @param t - Enum values to exclude
|
|
56
|
+
* @returns Array of remaining enum values
|
|
57
|
+
* @example
|
|
58
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
59
|
+
* Colors.omit("green") // ["red", "blue"]
|
|
60
|
+
*/
|
|
13
61
|
omit<O extends T>(...t: O[]): Exclude<T, O>[];
|
|
62
|
+
/**
|
|
63
|
+
* Get the zero-based index of an enum value.
|
|
64
|
+
* @param s - Enum value to find (can be null/undefined)
|
|
65
|
+
* @returns Index of the value or undefined if not found
|
|
66
|
+
* @example
|
|
67
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
68
|
+
* Colors.indexOf("green") // 1
|
|
69
|
+
* Colors.indexOf("purple") // undefined
|
|
70
|
+
*/
|
|
14
71
|
indexOf(s: Nullable<string>): Maybe<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Get the ordinal position of an enum value, or length if not found.
|
|
74
|
+
* Useful for sorting where invalid values should sort last.
|
|
75
|
+
* @param s - Enum value to find (can be null/undefined)
|
|
76
|
+
* @returns Index of the value, or enum length if not found
|
|
77
|
+
* @example
|
|
78
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
79
|
+
* Colors.ordinal("green") // 1
|
|
80
|
+
* Colors.ordinal("purple") // 3 (length)
|
|
81
|
+
*/
|
|
15
82
|
ordinal(s: Nullable<string>): number;
|
|
16
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Synonym for {@link getCI}. Get enum value with case-insensitive matching.
|
|
85
|
+
* @param s - String to validate (can be null/undefined)
|
|
86
|
+
* @returns Valid enum value or undefined if no match
|
|
87
|
+
*/
|
|
17
88
|
toValid(s: Nullable<string>): Maybe<T>;
|
|
18
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Find the first valid enum value from a list of candidates.
|
|
91
|
+
* @param arr - Array of potential enum values to check
|
|
92
|
+
* @returns First valid enum value found, or undefined if none match
|
|
93
|
+
* @example
|
|
94
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
95
|
+
* Colors.firstValid("purple", "GREEN", "red") // "green" (case-insensitive match)
|
|
96
|
+
*/
|
|
19
97
|
firstValid(...arr: Nullable<string>[]): Maybe<T>;
|
|
98
|
+
/**
|
|
99
|
+
* Apply a function to a string if it's a valid enum value.
|
|
100
|
+
* @param s - String to check and potentially transform
|
|
101
|
+
* @param f - Function to apply if s is a valid enum value
|
|
102
|
+
* @returns Result of function application, or undefined if s is invalid
|
|
103
|
+
* @example
|
|
104
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
105
|
+
* Colors.mapValid("red", color => color.toUpperCase()) // "RED"
|
|
106
|
+
* Colors.mapValid("purple", color => color.toUpperCase()) // undefined
|
|
107
|
+
*/
|
|
20
108
|
mapValid<R>(s: Nullable<string>, f: (t: T) => R): Maybe<R>;
|
|
109
|
+
/**
|
|
110
|
+
* Compare two strings based on their enum order.
|
|
111
|
+
* @param a - First string to compare
|
|
112
|
+
* @param b - Second string to compare
|
|
113
|
+
* @returns -1 if a < b, 0 if a === b, 1 if a > b, undefined if either is invalid
|
|
114
|
+
* @example
|
|
115
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
116
|
+
* Colors.cmp("red", "green") // -1 (red comes before green)
|
|
117
|
+
* Colors.cmp("blue", "red") // 1 (blue comes after red)
|
|
118
|
+
*/
|
|
21
119
|
cmp(a: Nullable<string>, b: Nullable<string>): Maybe<number>;
|
|
120
|
+
/**
|
|
121
|
+
* Check if first enum value comes before second in declaration order.
|
|
122
|
+
* @param a - First enum value
|
|
123
|
+
* @param b - Second enum value
|
|
124
|
+
* @returns True if a comes before b in the enum declaration
|
|
125
|
+
* @example
|
|
126
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
127
|
+
* Colors.lt("red", "green") // true
|
|
128
|
+
* Colors.lt("green", "red") // false
|
|
129
|
+
*/
|
|
22
130
|
lt(a: T, b: T): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Get the next enum value in declaration order.
|
|
133
|
+
* @param s - Current enum value
|
|
134
|
+
* @returns Next enum value, or undefined if s is the last value or invalid
|
|
135
|
+
* @example
|
|
136
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
137
|
+
* Colors.next("red") // "green"
|
|
138
|
+
* Colors.next("blue") // undefined (no next value)
|
|
139
|
+
*/
|
|
23
140
|
next(s: Nullable<string>): Maybe<T>;
|
|
24
141
|
/**
|
|
25
|
-
*
|
|
142
|
+
* Create a new StrEnum with the values in reverse order.
|
|
26
143
|
*
|
|
27
144
|
* (This follows the new "toReversed" ES2023 naming convention for methods that return a new object)
|
|
145
|
+
* @returns New StrEnum with values in reverse declaration order
|
|
146
|
+
* @example
|
|
147
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
148
|
+
* const Reversed = Colors.toReversed();
|
|
149
|
+
* Reversed.values // ["blue", "green", "red"]
|
|
28
150
|
*/
|
|
29
151
|
toReversed(): StrEnum<T>;
|
|
152
|
+
/**
|
|
153
|
+
* Makes the StrEnum iterable, allowing use in for...of loops and array destructuring.
|
|
154
|
+
* @returns Iterator that yields enum values in declaration order
|
|
155
|
+
* @example
|
|
156
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
157
|
+
* for (const color of Colors) {
|
|
158
|
+
* console.log(color); // "red", "green", "blue"
|
|
159
|
+
* }
|
|
160
|
+
* const [first, second] = Colors; // first="red", second="green"
|
|
161
|
+
*/
|
|
162
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
163
|
+
/**
|
|
164
|
+
* String tag used by Object.prototype.toString() for better debugging.
|
|
165
|
+
* @example
|
|
166
|
+
* const Colors = strEnum("red", "green", "blue");
|
|
167
|
+
* Object.prototype.toString.call(Colors) // "[object StrEnum]"
|
|
168
|
+
*/
|
|
169
|
+
[Symbol.toStringTag]: "StrEnum";
|
|
30
170
|
};
|
|
31
171
|
export type StrEnum<T extends string> = StrEnumType<T> & StrEnumHelpers<T>;
|
|
32
172
|
export type StrEnumKeys<Type> = Type extends StrEnum<infer X> ? X : never;
|
package/dist/StrEnum.js
CHANGED
package/dist/StrEnum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StrEnum.js","sourceRoot":"","sources":["../src/StrEnum.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"StrEnum.js","sourceRoot":"","sources":["../src/StrEnum.ts"],"names":[],"mappings":";;;AA0MA,0BAwFC;AAlSD,mCAA+B;AAE/B,qCAAuC;AAoMvC,SAAS,QAAQ,CAAC,CAAgB,EAAE,CAAgB;IAClD,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAChD,C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