@alextheman/utility 4.2.1 → 4.3.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/dist/index.cjs +12 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +12 -1
- package/package.json +2 -3
package/dist/index.cjs
CHANGED
|
@@ -202,7 +202,7 @@ var VersionNumber = class VersionNumber {
|
|
|
202
202
|
if (input.length !== 3) throw new DataError_default(input, "INVALID_LENGTH", VersionNumber.NON_NEGATIVE_TUPLE_ERROR);
|
|
203
203
|
const [major, minor, patch] = input.map((number) => {
|
|
204
204
|
const parsedInteger = parseIntStrict_default(number?.toString());
|
|
205
|
-
if (parsedInteger < 0) throw new DataError_default(input, "
|
|
205
|
+
if (parsedInteger < 0) throw new DataError_default(input, "NEGATIVE_INPUTS", VersionNumber.NON_NEGATIVE_TUPLE_ERROR);
|
|
206
206
|
return parsedInteger;
|
|
207
207
|
});
|
|
208
208
|
this.major = major;
|
|
@@ -265,6 +265,17 @@ var VersionNumber = class VersionNumber {
|
|
|
265
265
|
}[incrementType];
|
|
266
266
|
return new VersionNumber(newVersion);
|
|
267
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Checks if the provided version numbers have the exact same major, minor, and patch numbers.
|
|
270
|
+
*
|
|
271
|
+
* @param firstVersion - The first version number to compare.
|
|
272
|
+
* @param secondVersion - The second version number to compare.
|
|
273
|
+
*
|
|
274
|
+
* @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
|
|
275
|
+
*/
|
|
276
|
+
static isEqual(firstVersion, secondVersion) {
|
|
277
|
+
return firstVersion.major === secondVersion.major && firstVersion.minor === secondVersion.minor && firstVersion.patch === secondVersion.patch;
|
|
278
|
+
}
|
|
268
279
|
};
|
|
269
280
|
var VersionNumber_default = VersionNumber;
|
|
270
281
|
|
package/dist/index.d.cts
CHANGED
|
@@ -285,6 +285,15 @@ declare class VersionNumber {
|
|
|
285
285
|
* @returns A new instance of `VersionNumber` with the increment applied.
|
|
286
286
|
*/
|
|
287
287
|
increment(incrementType: VersionType): VersionNumber;
|
|
288
|
+
/**
|
|
289
|
+
* Checks if the provided version numbers have the exact same major, minor, and patch numbers.
|
|
290
|
+
*
|
|
291
|
+
* @param firstVersion - The first version number to compare.
|
|
292
|
+
* @param secondVersion - The second version number to compare.
|
|
293
|
+
*
|
|
294
|
+
* @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
|
|
295
|
+
*/
|
|
296
|
+
static isEqual(firstVersion: VersionNumber, secondVersion: VersionNumber): boolean;
|
|
288
297
|
}
|
|
289
298
|
//#endregion
|
|
290
299
|
//#region src/types/ArrayElement.d.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -285,6 +285,15 @@ declare class VersionNumber {
|
|
|
285
285
|
* @returns A new instance of `VersionNumber` with the increment applied.
|
|
286
286
|
*/
|
|
287
287
|
increment(incrementType: VersionType): VersionNumber;
|
|
288
|
+
/**
|
|
289
|
+
* Checks if the provided version numbers have the exact same major, minor, and patch numbers.
|
|
290
|
+
*
|
|
291
|
+
* @param firstVersion - The first version number to compare.
|
|
292
|
+
* @param secondVersion - The second version number to compare.
|
|
293
|
+
*
|
|
294
|
+
* @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
|
|
295
|
+
*/
|
|
296
|
+
static isEqual(firstVersion: VersionNumber, secondVersion: VersionNumber): boolean;
|
|
288
297
|
}
|
|
289
298
|
//#endregion
|
|
290
299
|
//#region src/types/ArrayElement.d.ts
|
package/dist/index.js
CHANGED
|
@@ -173,7 +173,7 @@ var VersionNumber = class VersionNumber {
|
|
|
173
173
|
if (input.length !== 3) throw new DataError_default(input, "INVALID_LENGTH", VersionNumber.NON_NEGATIVE_TUPLE_ERROR);
|
|
174
174
|
const [major, minor, patch] = input.map((number) => {
|
|
175
175
|
const parsedInteger = parseIntStrict_default(number?.toString());
|
|
176
|
-
if (parsedInteger < 0) throw new DataError_default(input, "
|
|
176
|
+
if (parsedInteger < 0) throw new DataError_default(input, "NEGATIVE_INPUTS", VersionNumber.NON_NEGATIVE_TUPLE_ERROR);
|
|
177
177
|
return parsedInteger;
|
|
178
178
|
});
|
|
179
179
|
this.major = major;
|
|
@@ -236,6 +236,17 @@ var VersionNumber = class VersionNumber {
|
|
|
236
236
|
}[incrementType];
|
|
237
237
|
return new VersionNumber(newVersion);
|
|
238
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Checks if the provided version numbers have the exact same major, minor, and patch numbers.
|
|
241
|
+
*
|
|
242
|
+
* @param firstVersion - The first version number to compare.
|
|
243
|
+
* @param secondVersion - The second version number to compare.
|
|
244
|
+
*
|
|
245
|
+
* @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
|
|
246
|
+
*/
|
|
247
|
+
static isEqual(firstVersion, secondVersion) {
|
|
248
|
+
return firstVersion.major === secondVersion.major && firstVersion.minor === secondVersion.minor && firstVersion.patch === secondVersion.patch;
|
|
249
|
+
}
|
|
239
250
|
};
|
|
240
251
|
var VersionNumber_default = VersionNumber;
|
|
241
252
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Helpful utility functions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,12 +19,11 @@
|
|
|
19
19
|
"zod": "^4.2.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@alextheman/eslint-plugin": "^5.0
|
|
22
|
+
"@alextheman/eslint-plugin": "^5.1.0",
|
|
23
23
|
"@types/node": "^25.0.3",
|
|
24
24
|
"alex-c-line": "^1.10.0",
|
|
25
25
|
"dotenv-cli": "^11.0.0",
|
|
26
26
|
"eslint": "^9.39.2",
|
|
27
|
-
"eslint-plugin-perfectionist": "^5.0.0",
|
|
28
27
|
"globals": "^16.5.0",
|
|
29
28
|
"husky": "^9.1.7",
|
|
30
29
|
"jsdom": "^27.3.0",
|