@alextheman/utility 4.2.0 → 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 CHANGED
@@ -181,7 +181,7 @@ var VersionNumber = class VersionNumber {
181
181
  minor = 0;
182
182
  /** The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice. */
183
183
  patch = 0;
184
- nonNegativeTupleError = "Input array must be a tuple of three non-negative integers.";
184
+ static NON_NEGATIVE_TUPLE_ERROR = "Input array must be a tuple of three non-negative integers.";
185
185
  /**
186
186
  * @param input - The input to create a new instance of `VersionNumber` from.
187
187
  */
@@ -199,10 +199,10 @@ var VersionNumber = class VersionNumber {
199
199
  this.minor = minor;
200
200
  this.patch = patch;
201
201
  } else if (Array.isArray(input)) {
202
- if (input.length !== 3) throw new DataError_default(input, "INVALID_LENGTH", this.nonNegativeTupleError);
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, "NON_POSITIVE_INPUTS", this.nonNegativeTupleError);
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
@@ -254,7 +254,7 @@ declare class VersionNumber {
254
254
  readonly minor: number;
255
255
  /** The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice. */
256
256
  readonly patch: number;
257
- private readonly nonNegativeTupleError;
257
+ private static readonly NON_NEGATIVE_TUPLE_ERROR;
258
258
  /**
259
259
  * @param input - The input to create a new instance of `VersionNumber` from.
260
260
  */
@@ -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
@@ -254,7 +254,7 @@ declare class VersionNumber {
254
254
  readonly minor: number;
255
255
  /** The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice. */
256
256
  readonly patch: number;
257
- private readonly nonNegativeTupleError;
257
+ private static readonly NON_NEGATIVE_TUPLE_ERROR;
258
258
  /**
259
259
  * @param input - The input to create a new instance of `VersionNumber` from.
260
260
  */
@@ -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
@@ -152,7 +152,7 @@ var VersionNumber = class VersionNumber {
152
152
  minor = 0;
153
153
  /** The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice. */
154
154
  patch = 0;
155
- nonNegativeTupleError = "Input array must be a tuple of three non-negative integers.";
155
+ static NON_NEGATIVE_TUPLE_ERROR = "Input array must be a tuple of three non-negative integers.";
156
156
  /**
157
157
  * @param input - The input to create a new instance of `VersionNumber` from.
158
158
  */
@@ -170,10 +170,10 @@ var VersionNumber = class VersionNumber {
170
170
  this.minor = minor;
171
171
  this.patch = patch;
172
172
  } else if (Array.isArray(input)) {
173
- if (input.length !== 3) throw new DataError_default(input, "INVALID_LENGTH", this.nonNegativeTupleError);
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, "NON_POSITIVE_INPUTS", this.nonNegativeTupleError);
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.2.0",
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.1",
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",