@js-utils-kit/types 1.0.0 → 1.2.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.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ArchiverOptions, ArchiverOptions as ArchiverOptions$1 } from "archiver";
2
+ import { HTTP_STATUS } from "@js-utils-kit/constants";
2
3
 
3
4
  //#region src/ArchiveFormat.d.ts
4
5
  /**
@@ -55,17 +56,28 @@ interface CreateArchiveOptions {
55
56
  * ```
56
57
  */
57
58
  declare const Environment: {
58
- /** Production environment (`"production"`) */
59
- readonly PROD: "production";
60
- /** Development environment (`"development"`) */
61
- readonly DEV: "development";
62
- /** Testing environment (`"test"`) */
63
- readonly TEST: "test";
64
- /** Unknown or undefined environment */
59
+ /** Production environment (`"production"`) */readonly PROD: "production"; /** Development environment (`"development"`) */
60
+ readonly DEV: "development"; /** Testing environment (`"test"`) */
61
+ readonly TEST: "test"; /** Unknown or undefined environment */
65
62
  readonly UNKNOWN: "unknown";
66
63
  };
67
64
  type Environment = (typeof Environment)[keyof typeof Environment];
68
65
  //#endregion
66
+ //#region src/Falsy.d.ts
67
+ /**
68
+ * Represents all JavaScript falsy values.
69
+ *
70
+ * These are values that coerce to `false` in boolean contexts.
71
+ *
72
+ * Includes:
73
+ * - `false`
74
+ * - `0`
75
+ * - `""` (empty string)
76
+ * - `null`
77
+ * - `undefined`
78
+ */
79
+ type Falsy = false | 0 | '' | null | undefined;
80
+ //#endregion
69
81
  //#region src/Hour.d.ts
70
82
  /**
71
83
  * Represents an hour value in a 24-hour format.
@@ -75,6 +87,25 @@ type Environment = (typeof Environment)[keyof typeof Environment];
75
87
  */
76
88
  type Hour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
77
89
  //#endregion
90
+ //#region src/HttpStatusCode.d.ts
91
+ /**
92
+ * Union type of all supported HTTP status codes.
93
+ *
94
+ * This type is derived directly from {@link HTTP_STATUS} and represents every possible numeric HTTP status value.
95
+ *
96
+ * Useful for enforcing strict type-safety when working with HTTP responses, middleware, validators, and utility functions.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * function handleStatus(code: HttpStatusCode) {
101
+ * if (code === HTTP_STATUS.NOT_FOUND) {
102
+ * // handle 404
103
+ * }
104
+ * }
105
+ * ```
106
+ */
107
+ type HttpStatusCode = (typeof HTTP_STATUS)[keyof typeof HTTP_STATUS];
108
+ //#endregion
78
109
  //#region src/MinuteOrSecond.d.ts
79
110
  /**
80
111
  * Represents a minute or second value in time.
@@ -119,4 +150,4 @@ interface Trim {
119
150
  normalizeWhitespace(str: string): string;
120
151
  }
121
152
  //#endregion
122
- export { ArchiveFormat, ArchiverOptions, CreateArchiveOptions, Environment, Hour, MinuteOrSecond, Trim };
153
+ export { ArchiveFormat, ArchiverOptions, CreateArchiveOptions, Environment, Falsy, Hour, HttpStatusCode, MinuteOrSecond, Trim };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ArchiverOptions, ArchiverOptions as ArchiverOptions$1 } from "archiver";
2
+ import { HTTP_STATUS } from "@js-utils-kit/constants";
2
3
 
3
4
  //#region src/ArchiveFormat.d.ts
4
5
  /**
@@ -55,17 +56,28 @@ interface CreateArchiveOptions {
55
56
  * ```
56
57
  */
57
58
  declare const Environment: {
58
- /** Production environment (`"production"`) */
59
- readonly PROD: "production";
60
- /** Development environment (`"development"`) */
61
- readonly DEV: "development";
62
- /** Testing environment (`"test"`) */
63
- readonly TEST: "test";
64
- /** Unknown or undefined environment */
59
+ /** Production environment (`"production"`) */readonly PROD: "production"; /** Development environment (`"development"`) */
60
+ readonly DEV: "development"; /** Testing environment (`"test"`) */
61
+ readonly TEST: "test"; /** Unknown or undefined environment */
65
62
  readonly UNKNOWN: "unknown";
66
63
  };
67
64
  type Environment = (typeof Environment)[keyof typeof Environment];
68
65
  //#endregion
66
+ //#region src/Falsy.d.ts
67
+ /**
68
+ * Represents all JavaScript falsy values.
69
+ *
70
+ * These are values that coerce to `false` in boolean contexts.
71
+ *
72
+ * Includes:
73
+ * - `false`
74
+ * - `0`
75
+ * - `""` (empty string)
76
+ * - `null`
77
+ * - `undefined`
78
+ */
79
+ type Falsy = false | 0 | '' | null | undefined;
80
+ //#endregion
69
81
  //#region src/Hour.d.ts
70
82
  /**
71
83
  * Represents an hour value in a 24-hour format.
@@ -75,6 +87,25 @@ type Environment = (typeof Environment)[keyof typeof Environment];
75
87
  */
76
88
  type Hour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
77
89
  //#endregion
90
+ //#region src/HttpStatusCode.d.ts
91
+ /**
92
+ * Union type of all supported HTTP status codes.
93
+ *
94
+ * This type is derived directly from {@link HTTP_STATUS} and represents every possible numeric HTTP status value.
95
+ *
96
+ * Useful for enforcing strict type-safety when working with HTTP responses, middleware, validators, and utility functions.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * function handleStatus(code: HttpStatusCode) {
101
+ * if (code === HTTP_STATUS.NOT_FOUND) {
102
+ * // handle 404
103
+ * }
104
+ * }
105
+ * ```
106
+ */
107
+ type HttpStatusCode = (typeof HTTP_STATUS)[keyof typeof HTTP_STATUS];
108
+ //#endregion
78
109
  //#region src/MinuteOrSecond.d.ts
79
110
  /**
80
111
  * Represents a minute or second value in time.
@@ -119,4 +150,4 @@ interface Trim {
119
150
  normalizeWhitespace(str: string): string;
120
151
  }
121
152
  //#endregion
122
- export { ArchiveFormat, ArchiverOptions, CreateArchiveOptions, Environment, Hour, MinuteOrSecond, Trim };
153
+ export { ArchiveFormat, ArchiverOptions, CreateArchiveOptions, Environment, Falsy, Hour, HttpStatusCode, MinuteOrSecond, Trim };