@alextheman/utility 1.13.0 → 1.13.2

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
@@ -211,14 +211,6 @@ function wait(seconds) {
211
211
  }
212
212
  var wait_default = wait;
213
213
 
214
- // src/types/Env.ts
215
- var import_zod = require("zod");
216
- var envSchema = import_zod.z.enum(["test", "development", "production"]);
217
- function newEnv(data = "development") {
218
- return envSchema.parse(data);
219
- }
220
- var Env_default = newEnv;
221
-
222
214
  // src/types/APIError.ts
223
215
  var httpErrorCodeLookup = {
224
216
  400: "BAD_REQUEST",
@@ -241,10 +233,19 @@ var APIError = class extends Error {
241
233
  } else {
242
234
  this.message = (_a = httpErrorCodeLookup[this.status]) != null ? _a : "API_ERROR";
243
235
  }
236
+ Object.defineProperty(this, "message", { enumerable: true });
244
237
  Object.setPrototypeOf(this, new.target.prototype);
245
238
  }
246
239
  };
247
240
  var APIError_default = APIError;
241
+
242
+ // src/types/Env.ts
243
+ var import_zod = require("zod");
244
+ var envSchema = import_zod.z.enum(["test", "development", "production"]);
245
+ function newEnv(data = "development") {
246
+ return envSchema.parse(data);
247
+ }
248
+ var Env_default = newEnv;
248
249
  // Annotate the CommonJS export names for ESM import in node:
249
250
  0 && (module.exports = {
250
251
  APIError,
package/dist/index.d.cts CHANGED
@@ -24,6 +24,13 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
24
24
 
25
25
  declare function wait(seconds: number): Promise<void>;
26
26
 
27
+ type HTTPErrorCodes = 400 | 401 | 403 | 404 | 418 | 500;
28
+ declare const httpErrorCodeLookup: Record<HTTPErrorCodes, string>;
29
+ declare class APIError extends Error {
30
+ status: number;
31
+ constructor(status?: number, message?: string, options?: ErrorOptions);
32
+ }
33
+
27
34
  declare const envSchema: z.ZodEnum<{
28
35
  test: "test";
29
36
  development: "development";
@@ -32,11 +39,4 @@ declare const envSchema: z.ZodEnum<{
32
39
  type Env = z.infer<typeof envSchema>;
33
40
  declare function newEnv(data?: unknown): Env;
34
41
 
35
- type HTTPErrorCodes = 400 | 401 | 403 | 404 | 418 | 500;
36
- declare const httpErrorCodeLookup: Record<HTTPErrorCodes, string>;
37
- declare class APIError extends Error {
38
- status: number;
39
- constructor(status?: number, message?: string, options?: ErrorOptions);
40
- }
41
-
42
42
  export { APIError, type Env, type HTTPErrorCodes, addDaysToDate, appendSemicolon, convertFileToBase64, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, isLeapYear, isMonthlyMultiple, isSameDate, newEnv, randomiseArray, range, truncate, wait };
package/dist/index.d.ts CHANGED
@@ -24,6 +24,13 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
24
24
 
25
25
  declare function wait(seconds: number): Promise<void>;
26
26
 
27
+ type HTTPErrorCodes = 400 | 401 | 403 | 404 | 418 | 500;
28
+ declare const httpErrorCodeLookup: Record<HTTPErrorCodes, string>;
29
+ declare class APIError extends Error {
30
+ status: number;
31
+ constructor(status?: number, message?: string, options?: ErrorOptions);
32
+ }
33
+
27
34
  declare const envSchema: z.ZodEnum<{
28
35
  test: "test";
29
36
  development: "development";
@@ -32,11 +39,4 @@ declare const envSchema: z.ZodEnum<{
32
39
  type Env = z.infer<typeof envSchema>;
33
40
  declare function newEnv(data?: unknown): Env;
34
41
 
35
- type HTTPErrorCodes = 400 | 401 | 403 | 404 | 418 | 500;
36
- declare const httpErrorCodeLookup: Record<HTTPErrorCodes, string>;
37
- declare class APIError extends Error {
38
- status: number;
39
- constructor(status?: number, message?: string, options?: ErrorOptions);
40
- }
41
-
42
42
  export { APIError, type Env, type HTTPErrorCodes, addDaysToDate, appendSemicolon, convertFileToBase64, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, isLeapYear, isMonthlyMultiple, isSameDate, newEnv, randomiseArray, range, truncate, wait };
package/dist/index.js CHANGED
@@ -173,14 +173,6 @@ function wait(seconds) {
173
173
  }
174
174
  var wait_default = wait;
175
175
 
176
- // src/types/Env.ts
177
- import { z } from "zod";
178
- var envSchema = z.enum(["test", "development", "production"]);
179
- function newEnv(data = "development") {
180
- return envSchema.parse(data);
181
- }
182
- var Env_default = newEnv;
183
-
184
176
  // src/types/APIError.ts
185
177
  var httpErrorCodeLookup = {
186
178
  400: "BAD_REQUEST",
@@ -203,10 +195,19 @@ var APIError = class extends Error {
203
195
  } else {
204
196
  this.message = (_a = httpErrorCodeLookup[this.status]) != null ? _a : "API_ERROR";
205
197
  }
198
+ Object.defineProperty(this, "message", { enumerable: true });
206
199
  Object.setPrototypeOf(this, new.target.prototype);
207
200
  }
208
201
  };
209
202
  var APIError_default = APIError;
203
+
204
+ // src/types/Env.ts
205
+ import { z } from "zod";
206
+ var envSchema = z.enum(["test", "development", "production"]);
207
+ function newEnv(data = "development") {
208
+ return envSchema.parse(data);
209
+ }
210
+ var Env_default = newEnv;
210
211
  export {
211
212
  APIError_default as APIError,
212
213
  addDaysToDate_default as addDaysToDate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",