@alextheman/utility 1.22.0 → 1.24.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 +4 -0
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -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
|
@@ -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">;
|
|
@@ -54,6 +55,8 @@ declare const uuidSchema: z.core.$ZodBranded<z.ZodUUID, "UUID">;
|
|
|
54
55
|
type UUID = z.infer<typeof uuidSchema>;
|
|
55
56
|
declare function parseUUID(UUID: unknown): UUID;
|
|
56
57
|
|
|
58
|
+
type NonUndefined<T> = T extends undefined ? never : T;
|
|
59
|
+
|
|
57
60
|
/**
|
|
58
61
|
* @deprecated validateUUID() is deprecated in favour of parseUUID()
|
|
59
62
|
*/
|
|
@@ -63,4 +66,4 @@ declare function wait(seconds: number): Promise<void>;
|
|
|
63
66
|
|
|
64
67
|
declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
65
68
|
|
|
66
|
-
export { APIError, type Email, type Env, type HTTPErrorCodes, type UUID, addDaysToDate, appendSemicolon, convertFileToBase64, fillArray, fillArrayAsync, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseUUID, randomiseArray, range, truncate, validateUUID, wait };
|
|
69
|
+
export { APIError, type Email, type Env, type HTTPErrorCodes, type NonUndefined, type UUID, addDaysToDate, appendSemicolon, convertFileToBase64, fillArray, fillArrayAsync, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseUUID, randomiseArray, range, truncate, validateUUID, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -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">;
|
|
@@ -54,6 +55,8 @@ declare const uuidSchema: z.core.$ZodBranded<z.ZodUUID, "UUID">;
|
|
|
54
55
|
type UUID = z.infer<typeof uuidSchema>;
|
|
55
56
|
declare function parseUUID(UUID: unknown): UUID;
|
|
56
57
|
|
|
58
|
+
type NonUndefined<T> = T extends undefined ? never : T;
|
|
59
|
+
|
|
57
60
|
/**
|
|
58
61
|
* @deprecated validateUUID() is deprecated in favour of parseUUID()
|
|
59
62
|
*/
|
|
@@ -63,4 +66,4 @@ declare function wait(seconds: number): Promise<void>;
|
|
|
63
66
|
|
|
64
67
|
declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
65
68
|
|
|
66
|
-
export { APIError, type Email, type Env, type HTTPErrorCodes, type UUID, addDaysToDate, appendSemicolon, convertFileToBase64, fillArray, fillArrayAsync, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseUUID, randomiseArray, range, truncate, validateUUID, wait };
|
|
69
|
+
export { APIError, type Email, type Env, type HTTPErrorCodes, type NonUndefined, type UUID, addDaysToDate, appendSemicolon, convertFileToBase64, fillArray, fillArrayAsync, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseUUID, randomiseArray, range, truncate, validateUUID, wait };
|
package/dist/index.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.24.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.
|
|
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.
|
|
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.
|
|
51
|
+
"typescript-eslint": "^8.46.0",
|
|
52
52
|
"vite-tsconfig-paths": "^5.1.4",
|
|
53
53
|
"vitest": "^3.2.4"
|
|
54
54
|
}
|