@alextheman/utility 5.12.0 → 5.13.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.
@@ -1,13 +1,3 @@
1
- //#region src/root/functions/miscellaneous/sayHello.d.ts
2
- /**
3
- * Returns a string representing the lyrics to the package's theme song, Commit To You
4
- *
5
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
6
- *
7
- * @returns The lyrics string in markdown format.
8
- */
9
- declare function sayHello(): string;
10
- //#endregion
11
1
  //#region src/v6/CodeError.d.ts
12
2
  interface ExpectErrorOptions$1<ErrorCode extends string = string> {
13
3
  expectedCode?: ErrorCode;
@@ -91,7 +81,7 @@ type DataErrorCode = CreateEnumType<typeof DataErrorCode>;
91
81
  *
92
82
  * @template DataType - The type of the data that caused the error.
93
83
  */
94
- declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode> extends CodeError<ErrorCode | DataErrorCode> {
84
+ declare class DataError<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode> extends CodeError<ErrorCode | DataErrorCode> {
95
85
  data: DataType;
96
86
  /**
97
87
  * @param data - The data that caused the error.
@@ -107,7 +97,7 @@ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<P
107
97
  *
108
98
  * @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`.
109
99
  */
110
- static check(input: unknown): input is DataError;
100
+ static check<DataType extends object = Record<PropertyKey, unknown>, ErrorCode extends string = DataErrorCode>(input: unknown): input is DataError<DataType, ErrorCode>;
111
101
  /**
112
102
  * Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
113
103
  *
@@ -134,4 +124,14 @@ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<P
134
124
  static expectErrorAsync<DataType extends Record<PropertyKey, unknown>, ErrorCode extends string = DefaultDataErrorCode>(errorFunction: () => Promise<unknown>, options?: ExpectErrorOptions<ErrorCode>): Promise<DataError<DataType, ErrorCode>>;
135
125
  }
136
126
  //#endregion
127
+ //#region src/v6/sayHello.d.ts
128
+ /**
129
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
130
+ *
131
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
132
+ *
133
+ * @returns The lyrics string in markdown format.
134
+ */
135
+ declare function sayHello(): string;
136
+ //#endregion
137
137
  export { CodeError, DataError, DataErrorCode, type ExpectErrorOptions, type IsTypeArgumentString, sayHello };
package/dist/v6/index.js CHANGED
@@ -137,119 +137,6 @@ function normaliseIndents(first, ...args) {
137
137
  return reduceLines(interpolate(strings, ...[...args]).split("\n"), options);
138
138
  }
139
139
  //#endregion
140
- //#region src/root/functions/miscellaneous/sayHello.ts
141
- /**
142
- * Returns a string representing the lyrics to the package's theme song, Commit To You
143
- *
144
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
145
- *
146
- * @returns The lyrics string in markdown format.
147
- */
148
- function sayHello() {
149
- return normaliseIndents`
150
- # Commit To You
151
-
152
- ### Verse 1
153
-
154
- I know you've been checking me out,
155
- Shall we take it to the next level now?
156
- 'Cause I really wanna be there all for you,
157
- All for you!
158
- Come on now, let's make a fresh start!
159
- Pin my number, then you can take me out!
160
- Can't you see I really do care about you,
161
- About you!
162
-
163
- ### Pre-chorus 1
164
- Although our calendars are imperfect, at best,
165
- I'd like to organise time with you! (with you!).
166
- Just tell me when and I'll make it clear,
167
- All clear for you,
168
- All clear for you!
169
- (One, two, three, go!)
170
-
171
- ### Chorus
172
- I wanna be of utility, I'll help you on the run!
173
- I'll be the one here in the back, while you go have some fun!
174
- Looking out for you tonight, I'll be the one you can rely on!
175
- Watch you go and watch me pass by,
176
- I'll be here!
177
- I'll commit to you!
178
-
179
- ### Verse 2
180
- Though sometimes it won't be easy,
181
- You'll be here to bring out the best in me,
182
- And I'll hold myself to high standards for you!
183
- All for you!
184
- We'll grow as a pair, you and me,
185
- We'll build up a healthy dependency,
186
- You can build with me and I'll develop with you!
187
- I'm with you!
188
-
189
- ### Pre-chorus 2
190
- I'll be with you when you're up or you're down,
191
- We'll deal with all our problems together (together!)
192
- Just tell me what you want, I'll make it clear,
193
- All clear for you,
194
- All clear for you!
195
- (One, three, one, go!)
196
-
197
- ### Chorus
198
- I wanna be of utility, I'll help you on the run!
199
- (help you on the run!)
200
- I'll be the one here in the back, while you go have some fun!
201
- (you go have some fun!)
202
- Looking out for you tonight, I'll be the one you can rely on!
203
- Watch you go and watch me pass by,
204
- I'll be here!
205
- I'll commit to you!
206
-
207
- ### Bridge
208
- Looking into our stack!
209
- I'll commit to you!
210
- We've got a lot to unpack!
211
- I'll commit to you!
212
- The environment that we're in!
213
- I'll commit to you!
214
- Delicate as a string!
215
- I'll commit to you!
216
-
217
- But I think you're my type!
218
- I'll commit to you!
219
- Oh, this feels all so right!
220
- I'll commit to you!
221
- Nothing stopping us now!
222
- I'll commit to you!
223
- Let's show them what we're about!
224
- Two, three, four, go!
225
-
226
- ### Final Chorus
227
- I wanna be of utility, I'll help you on the run!
228
- (help you on the run!)
229
- I'll be the one here in the back, while you go have some fun!
230
- (you go have some fun!)
231
- Looking out for you tonight, I'll be the one you can rely on!
232
- Watch you go and watch me pass by,
233
- I'll be here!
234
- I'll commit to you!
235
-
236
- I wanna be of utility, I'll help you on the run!
237
- (I'll commit to you!)
238
- I'll be the one here in the back, while you go have some fun!
239
- (I'll commit to you!)
240
- Looking out for you tonight, I'll be the one you can rely on!
241
- (I'll commit to you!)
242
- Watch you go and watch me pass by,
243
- (I'll commit to you!)
244
- I'll be here!
245
-
246
- ### Outro
247
- I'll commit to you!
248
- I'll commit to you!
249
- I'll commit to you!
250
- `;
251
- }
252
- //#endregion
253
140
  //#region src/v6/CodeError.ts
254
141
  /**
255
142
  * Represents errors that can be described using a standardised error code, and a human-readable error message.
@@ -370,8 +257,7 @@ var DataError = class DataError extends CodeError {
370
257
  */
371
258
  static check(input) {
372
259
  if (input instanceof DataError) return true;
373
- const data = input;
374
- return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
260
+ return typeof input === "object" && input !== null && "message" in input && typeof input.message === "string" && "code" in input && typeof input.code === "string" && "data" in input;
375
261
  }
376
262
  /**
377
263
  * Gets the thrown `DataError` from a given function if one was thrown, and re-throws any other errors, or throws a default `DataError` if no error thrown.
@@ -403,4 +289,117 @@ var DataError = class DataError extends CodeError {
403
289
  }
404
290
  };
405
291
  //#endregion
292
+ //#region src/v6/sayHello.ts
293
+ /**
294
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
295
+ *
296
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
297
+ *
298
+ * @returns The lyrics string in markdown format.
299
+ */
300
+ function sayHello() {
301
+ return `
302
+ # Commit To You
303
+
304
+ ### Verse 1
305
+
306
+ I know you've been checking me out,
307
+ Shall we take it to the next level now?
308
+ 'Cause I really wanna be there all for you,
309
+ All for you!
310
+ Come on now, let's make a fresh start!
311
+ Pin my number, then you can take me out!
312
+ Can't you see I really do care about you,
313
+ About you!
314
+
315
+ ### Pre-chorus 1
316
+ Although our calendars are imperfect, at best,
317
+ I'd like to organise time with you! (with you!).
318
+ Just tell me when and I'll make it clear,
319
+ All clear for you,
320
+ All clear for you!
321
+ (One, two, three, go!)
322
+
323
+ ### Chorus
324
+ I wanna be of utility, I'll help you on the run!
325
+ I'll be the one here in the back, while you go have some fun!
326
+ Looking out for you tonight, I'll be the one you can rely on!
327
+ Watch you go and watch me pass by,
328
+ I'll be here!
329
+ I'll commit to you!
330
+
331
+ ### Verse 2
332
+ Though sometimes it won't be easy,
333
+ You'll be here to bring out the best in me,
334
+ And I'll hold myself to high standards for you!
335
+ All for you!
336
+ We'll grow as a pair, you and me,
337
+ We'll build up a healthy dependency,
338
+ You can build with me and I'll develop with you!
339
+ I'm with you!
340
+
341
+ ### Pre-chorus 2
342
+ I'll be with you when you're up or you're down,
343
+ We'll deal with all our problems together (together!)
344
+ Just tell me what you want, I'll make it clear,
345
+ All clear for you,
346
+ All clear for you!
347
+ (One, three, one, go!)
348
+
349
+ ### Chorus
350
+ I wanna be of utility, I'll help you on the run!
351
+ (help you on the run!)
352
+ I'll be the one here in the back, while you go have some fun!
353
+ (you go have some fun!)
354
+ Looking out for you tonight, I'll be the one you can rely on!
355
+ Watch you go and watch me pass by,
356
+ I'll be here!
357
+ I'll commit to you!
358
+
359
+ ### Bridge
360
+ Looking into our stack!
361
+ I'll commit to you!
362
+ We've got a lot to unpack!
363
+ I'll commit to you!
364
+ The environment that we're in!
365
+ I'll commit to you!
366
+ Delicate as a string!
367
+ I'll commit to you!
368
+
369
+ But I think you're my type!
370
+ I'll commit to you!
371
+ Oh, this feels all so right!
372
+ I'll commit to you!
373
+ Nothing stopping us now!
374
+ I'll commit to you!
375
+ Let's show them what we're about!
376
+ Two, three, four, go!
377
+
378
+ ### Final Chorus
379
+ I wanna be of utility, I'll help you on the run!
380
+ (help you on the run!)
381
+ I'll be the one here in the back, while you go have some fun!
382
+ (you go have some fun!)
383
+ Looking out for you tonight, I'll be the one you can rely on!
384
+ Watch you go and watch me pass by,
385
+ I'll be here!
386
+ I'll commit to you!
387
+
388
+ I wanna be of utility, I'll help you on the run!
389
+ (I'll commit to you!)
390
+ I'll be the one here in the back, while you go have some fun!
391
+ (I'll commit to you!)
392
+ Looking out for you tonight, I'll be the one you can rely on!
393
+ (I'll commit to you!)
394
+ Watch you go and watch me pass by,
395
+ (I'll commit to you!)
396
+ I'll be here!
397
+
398
+ ### Outro
399
+ I'll commit to you!
400
+ I'll commit to you!
401
+ I'll commit to you!
402
+ `;
403
+ }
404
+ //#endregion
406
405
  export { CodeError, DataError, DataErrorCode, sayHello };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "5.12.0",
3
+ "version": "5.13.1",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",