@alextheman/utility 4.14.0 → 4.14.1

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
@@ -110,7 +110,7 @@ const httpErrorCodeLookup = {
110
110
  *
111
111
  * @category Types
112
112
  */
113
- var APIError = class extends Error {
113
+ var APIError = class APIError extends Error {
114
114
  status;
115
115
  /**
116
116
  * @param status - A HTTP status code. Can be any number, but numbers between 400 and 600 are encouraged to fit with HTTP status code conventions.
@@ -133,6 +133,7 @@ var APIError = class extends Error {
133
133
  * @returns `true` if the input is an APIError, and `false` otherwise. The type of the input will also be narrowed down to APIError if `true`.
134
134
  */
135
135
  static check(input) {
136
+ if (input instanceof APIError) return true;
136
137
  const data = input;
137
138
  return typeof data === "object" && data !== null && typeof data?.status === "number" && typeof data?.message === "string";
138
139
  }
@@ -145,7 +146,7 @@ var APIError = class extends Error {
145
146
  *
146
147
  * @category Types
147
148
  */
148
- var DataError = class extends Error {
149
+ var DataError = class DataError extends Error {
149
150
  code;
150
151
  data;
151
152
  /**
@@ -171,6 +172,7 @@ var DataError = class extends Error {
171
172
  * @returns `true` if the input is a DataError, and `false` otherwise. The type of the input will also be narrowed down to DataError if `true`.
172
173
  */
173
174
  static check(input) {
175
+ if (input instanceof DataError) return true;
174
176
  const data = input;
175
177
  return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
176
178
  }
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ const httpErrorCodeLookup = {
79
79
  *
80
80
  * @category Types
81
81
  */
82
- var APIError = class extends Error {
82
+ var APIError = class APIError extends Error {
83
83
  status;
84
84
  /**
85
85
  * @param status - A HTTP status code. Can be any number, but numbers between 400 and 600 are encouraged to fit with HTTP status code conventions.
@@ -102,6 +102,7 @@ var APIError = class extends Error {
102
102
  * @returns `true` if the input is an APIError, and `false` otherwise. The type of the input will also be narrowed down to APIError if `true`.
103
103
  */
104
104
  static check(input) {
105
+ if (input instanceof APIError) return true;
105
106
  const data = input;
106
107
  return typeof data === "object" && data !== null && typeof data?.status === "number" && typeof data?.message === "string";
107
108
  }
@@ -114,7 +115,7 @@ var APIError = class extends Error {
114
115
  *
115
116
  * @category Types
116
117
  */
117
- var DataError = class extends Error {
118
+ var DataError = class DataError extends Error {
118
119
  code;
119
120
  data;
120
121
  /**
@@ -140,6 +141,7 @@ var DataError = class extends Error {
140
141
  * @returns `true` if the input is a DataError, and `false` otherwise. The type of the input will also be narrowed down to DataError if `true`.
141
142
  */
142
143
  static check(input) {
144
+ if (input instanceof DataError) return true;
143
145
  const data = input;
144
146
  return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
145
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "4.14.0",
3
+ "version": "4.14.1",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",