@alextheman/utility 1.21.1 → 1.23.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
@@ -237,7 +237,7 @@ function isMonthlyMultiple(firstDate, secondDate) {
237
237
  var isMonthlyMultiple_default = isMonthlyMultiple;
238
238
 
239
239
  // src/functions/omitProperties.ts
240
- function omitProperties(keysToOmit, object) {
240
+ function omitProperties(object, keysToOmit) {
241
241
  const outputObject = __spreadValues({}, object);
242
242
  const keysArray = Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit];
243
243
  keysArray.forEach((key) => {
@@ -317,6 +317,10 @@ var APIError = class extends Error {
317
317
  Object.defineProperty(this, "message", { enumerable: true });
318
318
  Object.setPrototypeOf(this, new.target.prototype);
319
319
  }
320
+ static check(input) {
321
+ const data = input;
322
+ return typeof data === "object" && data !== null && typeof (data == null ? void 0 : data.status) === "number" && typeof (data == null ? void 0 : data.message) === "string";
323
+ }
320
324
  };
321
325
  var APIError_default = APIError;
322
326
 
package/dist/index.d.cts CHANGED
@@ -23,7 +23,7 @@ declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
23
23
 
24
24
  declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
25
25
 
26
- declare function omitProperties<T extends Record<string, unknown>, K extends keyof T>(keysToOmit: K | readonly K[], object: T): Omit<T, K>;
26
+ declare function omitProperties<T extends Record<string, unknown>, K extends keyof T>(object: T, keysToOmit: K | readonly K[]): Omit<T, K>;
27
27
 
28
28
  declare function randomiseArray<T>(array: T[]): T[];
29
29
 
@@ -36,6 +36,7 @@ declare const httpErrorCodeLookup: Record<HTTPErrorCodes, string>;
36
36
  declare class APIError extends Error {
37
37
  status: number;
38
38
  constructor(status?: HTTPErrorCodes | number, message?: string, options?: ErrorOptions);
39
+ static check(input: unknown): input is APIError;
39
40
  }
40
41
 
41
42
  declare const emailSchema: z.core.$ZodBranded<z.ZodEmail, "Email">;
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
23
23
 
24
24
  declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
25
25
 
26
- declare function omitProperties<T extends Record<string, unknown>, K extends keyof T>(keysToOmit: K | readonly K[], object: T): Omit<T, K>;
26
+ declare function omitProperties<T extends Record<string, unknown>, K extends keyof T>(object: T, keysToOmit: K | readonly K[]): Omit<T, K>;
27
27
 
28
28
  declare function randomiseArray<T>(array: T[]): T[];
29
29
 
@@ -36,6 +36,7 @@ declare const httpErrorCodeLookup: Record<HTTPErrorCodes, string>;
36
36
  declare class APIError extends Error {
37
37
  status: number;
38
38
  constructor(status?: HTTPErrorCodes | number, message?: string, options?: ErrorOptions);
39
+ static check(input: unknown): input is APIError;
39
40
  }
40
41
 
41
42
  declare const emailSchema: z.core.$ZodBranded<z.ZodEmail, "Email">;
package/dist/index.js CHANGED
@@ -183,7 +183,7 @@ function isMonthlyMultiple(firstDate, secondDate) {
183
183
  var isMonthlyMultiple_default = isMonthlyMultiple;
184
184
 
185
185
  // src/functions/omitProperties.ts
186
- function omitProperties(keysToOmit, object) {
186
+ function omitProperties(object, keysToOmit) {
187
187
  const outputObject = __spreadValues({}, object);
188
188
  const keysArray = Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit];
189
189
  keysArray.forEach((key) => {
@@ -263,6 +263,10 @@ var APIError = class extends Error {
263
263
  Object.defineProperty(this, "message", { enumerable: true });
264
264
  Object.setPrototypeOf(this, new.target.prototype);
265
265
  }
266
+ static check(input) {
267
+ const data = input;
268
+ return typeof data === "object" && data !== null && typeof (data == null ? void 0 : data.status) === "number" && typeof (data == null ? void 0 : data.message) === "string";
269
+ }
266
270
  };
267
271
  var APIError_default = APIError;
268
272
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "1.21.1",
3
+ "version": "1.23.0",
4
4
  "description": "Helpful utility functions",
5
5
  "license": "ISC",
6
6
  "author": "alextheman",
@@ -33,12 +33,12 @@
33
33
  "update-dependencies": "bash -c 'npx npm-check-updates -u \"$@\" && npm install' --"
34
34
  },
35
35
  "dependencies": {
36
- "zod": "^4.1.11"
36
+ "zod": "^4.1.12"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@alextheman/eslint-plugin": "^1.14.2",
40
40
  "@eslint/js": "^9.37.0",
41
- "@types/node": "^24.6.2",
41
+ "@types/node": "^24.7.1",
42
42
  "eslint": "^9.37.0",
43
43
  "eslint-import-resolver-typescript": "^4.4.4",
44
44
  "eslint-plugin-import": "^2.32.0",
@@ -48,7 +48,7 @@
48
48
  "prettier": "^3.6.2",
49
49
  "tsup": "^8.5.0",
50
50
  "typescript": "^5.9.3",
51
- "typescript-eslint": "^8.45.0",
51
+ "typescript-eslint": "^8.46.0",
52
52
  "vite-tsconfig-paths": "^5.1.4",
53
53
  "vitest": "^3.2.4"
54
54
  }