@alextheman/utility 5.6.5 → 5.7.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,5 +1,5 @@
1
- import z$1, { ZodError, ZodType, z } from "zod";
2
1
  import { DotenvParseOutput } from "dotenv";
2
+ import z$1, { ZodError, ZodType, z } from "zod";
3
3
 
4
4
  //#region src/root/constants/FILE_PATH_REGEX.d.ts
5
5
  declare const FILE_PATH_PATTERN: string;
@@ -222,6 +222,219 @@ declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
222
222
  */
223
223
  declare function convertFileToBase64(file: File): Promise<string>;
224
224
  //#endregion
225
+ //#region src/root/functions/miscellaneous/createFormData.d.ts
226
+ type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
227
+ type FormDataArrayResolutionStrategy = "stringify" | "multiple";
228
+ /**
229
+ * Base options for resolving form data.
230
+ *
231
+ * @category Function Options
232
+ *
233
+ * @template Key - The type of the key of the input record.
234
+ */
235
+ interface CreateFormDataOptionsBase<Key extends PropertyKey> {
236
+ /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
237
+ arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
238
+ }
239
+ /**
240
+ * Options for resolving form data when it may be undefined or null, but not both.
241
+ *
242
+ * @category Function Options
243
+ *
244
+ * @template Key - The type of the key of the input record.
245
+ */
246
+ interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends PropertyKey> extends CreateFormDataOptionsBase<Key> {
247
+ /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
248
+ undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
249
+ /** How to resolve null data (May either stringify to 'null', resolve to an empty string, or omit entirely). */
250
+ nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
251
+ /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
252
+ nullableResolution?: never;
253
+ }
254
+ /**
255
+ * Options for resolving form data when it may be nullable, but not both.
256
+ *
257
+ * @category Function Options
258
+ *
259
+ * @template Key - The type of the key of the input record.
260
+ */
261
+ interface CreateFormDataOptionsNullableResolution<Key extends PropertyKey> extends CreateFormDataOptionsBase<Key> {
262
+ /** @note This must not be provided at the same time as nullableResolution. */
263
+ undefinedResolution?: never;
264
+ /** @note This must not be provided at the same time as nullableResolution. */
265
+ nullResolution?: never;
266
+ /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
267
+ nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
268
+ }
269
+ /**
270
+ * Options for resolving form data.
271
+ *
272
+ * @category Function Options
273
+ *
274
+ * @template Key - The type of the key of the input record.
275
+ */
276
+ type CreateFormDataOptions<Key extends PropertyKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
277
+ /**
278
+ * Creates FormData from a given object, resolving non-string types as appropriate.
279
+ *
280
+ * @category Miscellaneous
281
+ *
282
+ * @template DataType - The type of the given data.
283
+ *
284
+ * @param data - The data to create FormData from.
285
+ * @param options - Options to apply to the conversion.
286
+ *
287
+ * @returns A FormData object with the data applied.
288
+ */
289
+ declare function createFormData<DataType extends Record<PropertyKey, unknown>>(data: DataType, options?: CreateFormDataOptions<keyof DataType>): FormData;
290
+ //#endregion
291
+ //#region src/root/functions/miscellaneous/getRandomNumber.d.ts
292
+ /**
293
+ * Gets a random number between the given bounds.
294
+ *
295
+ * @category Miscellaneous
296
+ *
297
+ * @param lowerBound - The lowest number that can be chosen.
298
+ * @param upperBound - The highest number that can be chosen.
299
+ *
300
+ * @returns A random number between the provided lower bound and upper bound.
301
+ */
302
+ declare function getRandomNumber(lowerBound: number, upperBound: number): number;
303
+ //#endregion
304
+ //#region src/root/functions/miscellaneous/isOrdered.d.ts
305
+ /**
306
+ * Checks to see if the given array is sorted in ascending order.
307
+ *
308
+ * @category Miscellaneous
309
+ *
310
+ * @param array - The array to check.
311
+ *
312
+ * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
313
+ */
314
+ declare function isOrdered(array: ReadonlyArray<number>): boolean;
315
+ //#endregion
316
+ //#region src/root/functions/miscellaneous/sayHello.d.ts
317
+ /**
318
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
319
+ *
320
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
321
+ *
322
+ * @returns The lyrics string in markdown format.
323
+ */
324
+ declare function sayHello(): string;
325
+ //#endregion
326
+ //#region src/root/functions/miscellaneous/stringifyDotenv.d.ts
327
+ type QuoteStyle = "double" | "single" | "none";
328
+ interface StringifyDotenvOptions {
329
+ /** The quote style to use for the values (defaults to `"double"`) */
330
+ quoteStyle: QuoteStyle;
331
+ }
332
+ /**
333
+ * Converts an object into a string in .env file format.
334
+ *
335
+ * @param contents - The object to convert. Must be a record whose values are strings.
336
+ * @param options - Extra options to apply.
337
+ *
338
+ * @returns A string representation of the object in .env file format.
339
+ */
340
+ declare function stringifyDotenv(contents: Record<PropertyKey, string> | DotenvParseOutput, options?: StringifyDotenvOptions): string;
341
+ //#endregion
342
+ //#region src/root/functions/miscellaneous/stringListToArray.d.ts
343
+ /**
344
+ * Options to apply to the conversion of a string list to an array.
345
+ *
346
+ * @category Function Options
347
+ */
348
+ interface StringListToArrayOptions {
349
+ /** What each item in the list is separated by. */
350
+ separator?: string;
351
+ /** An option to trim any extra whitespace. */
352
+ trimWhitespace?: boolean;
353
+ }
354
+ /**
355
+ * Converts a stringly-typed list to a proper array.
356
+ *
357
+ * @category Miscellaneous
358
+ *
359
+ * @param stringList - The stringly-typed list to convert.
360
+ * @param options - The options to apply to the conversion.
361
+ * @param options.separator - What each item in the list is separated by.
362
+ * @param options.trimWhitespace - An option to trim any extra whitespace.
363
+ *
364
+ * @returns A new array with each item being an item from the given list.
365
+ */
366
+ declare function stringListToArray(stringList: string, {
367
+ separator,
368
+ trimWhitespace
369
+ }?: StringListToArrayOptions): Array<string>;
370
+ //#endregion
371
+ //#region src/root/functions/miscellaneous/wait.d.ts
372
+ /**
373
+ * Waits for the given number of seconds
374
+ *
375
+ * @category Miscellaneous
376
+ *
377
+ * @param seconds - The number of seconds to wait.
378
+ *
379
+ * @returns A Promise that resolves after the given number of seconds.
380
+ */
381
+ declare function wait(seconds: number): Promise<void>;
382
+ //#endregion
383
+ //#region src/root/functions/objectHelpers/getRecordKeys.d.ts
384
+ /**
385
+ * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
386
+ *
387
+ * @category Object Helpers
388
+ *
389
+ * @template InputRecordType - The type of the input object.
390
+ *
391
+ * @param record - The record to get the keys from.
392
+ *
393
+ * @returns An array with all the keys of the input object in string form, but properly typed as `keyof InputRecordType`.
394
+ */
395
+ declare function getRecordKeys<InputRecordType extends Record<PropertyKey, unknown>>(record: InputRecordType & object): Array<keyof InputRecordType>;
396
+ //#endregion
397
+ //#region src/root/functions/objectHelpers/omitProperties.d.ts
398
+ /**
399
+ * Omits properties from a given object.
400
+ *
401
+ * @category Object Helpers
402
+ *
403
+ * @template ObjectType - The type of the input object.
404
+ * @template KeysToOmit - A type representing the keys to omit from the object.
405
+ *
406
+ * @param object - The object to omit properties from.
407
+ * @param keysToOmit - The keys to omit from the object. Can either be a single string to omit one, or an array to omit multiple.
408
+ *
409
+ * @returns An object with a new reference in memory, with the properties omitted.
410
+ */
411
+ declare function omitProperties<ObjectType extends Record<string, unknown> | Readonly<Record<string, unknown>>, KeysToOmit extends keyof ObjectType>(object: ObjectType, keysToOmit: KeysToOmit | ReadonlyArray<KeysToOmit>): Omit<ObjectType, KeysToOmit>;
412
+ //#endregion
413
+ //#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
414
+ type RemoveUndefined<RecordType extends Record<PropertyKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
415
+ /**
416
+ * Removes entries whose values are `undefined` from a given object (not including null etc.).
417
+ *
418
+ * @param object - The object to remove undefined entries from.
419
+ *
420
+ * @returns An object with a new reference in memory, with undefined entries removed.
421
+ */
422
+ declare function removeUndefinedFromObject<RecordType extends Record<PropertyKey, unknown>>(object: RecordType): RemoveUndefined<RecordType>;
423
+ //#endregion
424
+ //#region src/root/functions/parsers/parseBoolean.d.ts
425
+ /**
426
+ * Takes a stringly-typed boolean and converts it to an actual boolean type.
427
+ *
428
+ * @category Parsers
429
+ *
430
+ * @param inputString - The string to parse.
431
+ *
432
+ * @throws {DataError} If the string is not either `true` or `false` (case insensitive).
433
+ *
434
+ * @returns The string parsed as an actual boolean.
435
+ */
436
+ declare function parseBoolean(inputString: string): boolean;
437
+ //#endregion
225
438
  //#region src/root/types/APIError.d.ts
226
439
  type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
227
440
  declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
@@ -248,14 +461,6 @@ declare class APIError extends Error {
248
461
  static check(input: unknown): input is APIError;
249
462
  }
250
463
  //#endregion
251
- //#region src/root/types/RecordKey.d.ts
252
- /**
253
- * Represents the native Record's possible key type.
254
- *
255
- * @category Types
256
- */
257
- type RecordKey = string | number | symbol;
258
- //#endregion
259
464
  //#region src/root/types/DataError.d.ts
260
465
  interface ExpectErrorOptions {
261
466
  expectedCode?: string;
@@ -267,7 +472,7 @@ interface ExpectErrorOptions {
267
472
  *
268
473
  * @template DataType - The type of the data that caused the error.
269
474
  */
270
- declare class DataError<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>> extends Error {
475
+ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>> extends Error {
271
476
  code: string;
272
477
  data: DataType;
273
478
  /**
@@ -285,7 +490,7 @@ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<Rec
285
490
  *
286
491
  * @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`.
287
492
  */
288
- static check<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>>(input: unknown): input is DataError<DataType>;
493
+ static check<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>(input: unknown): input is DataError<DataType>;
289
494
  /**
290
495
  * 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.
291
496
  *
@@ -411,6 +616,16 @@ declare class VersionNumber {
411
616
  }
412
617
  declare const zodVersionNumber: z$1.ZodType<VersionNumber>;
413
618
  //#endregion
619
+ //#region src/root/deprecated/RecordKey.d.ts
620
+ /**
621
+ * Represents the native Record's possible key type.
622
+ *
623
+ * @category Types
624
+ *
625
+ * @deprecated Please use the native `PropertyKey` type instead.
626
+ */
627
+ type RecordKey = string | number | symbol;
628
+ //#endregion
414
629
  //#region src/root/types/ArrayElement.d.ts
415
630
  /**
416
631
  * Gets the individual element types from an array type.
@@ -432,7 +647,7 @@ type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) =>
432
647
  *
433
648
  * @template ObjectType - The type of the object to get the value types for.
434
649
  */
435
- type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
650
+ type CreateEnumType<ObjectType extends Record<PropertyKey, unknown>> = ObjectType[keyof ObjectType];
436
651
  //#endregion
437
652
  //#region src/root/types/DisallowUndefined.d.ts
438
653
  /**
@@ -489,219 +704,6 @@ type NullableOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condit
489
704
  */
490
705
  type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condition extends true ? ResolvedTypeIfTrue : ResolvedTypeIfTrue | undefined;
491
706
  //#endregion
492
- //#region src/root/functions/miscellaneous/createFormData.d.ts
493
- type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
494
- type FormDataArrayResolutionStrategy = "stringify" | "multiple";
495
- /**
496
- * Base options for resolving form data.
497
- *
498
- * @category Function Options
499
- *
500
- * @template Key - The type of the key of the input record.
501
- */
502
- interface CreateFormDataOptionsBase<Key extends RecordKey> {
503
- /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
504
- arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
505
- }
506
- /**
507
- * Options for resolving form data when it may be undefined or null, but not both.
508
- *
509
- * @category Function Options
510
- *
511
- * @template Key - The type of the key of the input record.
512
- */
513
- interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
514
- /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
515
- undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
516
- /** How to resolve null data (May either stringify to 'null', resolve to an empty string, or omit entirely). */
517
- nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
518
- /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
519
- nullableResolution?: never;
520
- }
521
- /**
522
- * Options for resolving form data when it may be nullable, but not both.
523
- *
524
- * @category Function Options
525
- *
526
- * @template Key - The type of the key of the input record.
527
- */
528
- interface CreateFormDataOptionsNullableResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
529
- /** @note This must not be provided at the same time as nullableResolution. */
530
- undefinedResolution?: never;
531
- /** @note This must not be provided at the same time as nullableResolution. */
532
- nullResolution?: never;
533
- /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
534
- nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
535
- }
536
- /**
537
- * Options for resolving form data.
538
- *
539
- * @category Function Options
540
- *
541
- * @template Key - The type of the key of the input record.
542
- */
543
- type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
544
- /**
545
- * Creates FormData from a given object, resolving non-string types as appropriate.
546
- *
547
- * @category Miscellaneous
548
- *
549
- * @template DataType - The type of the given data.
550
- *
551
- * @param data - The data to create FormData from.
552
- * @param options - Options to apply to the conversion.
553
- *
554
- * @returns A FormData object with the data applied.
555
- */
556
- declare function createFormData<DataType extends Record<RecordKey, unknown>>(data: DataType, options?: CreateFormDataOptions<keyof DataType>): FormData;
557
- //#endregion
558
- //#region src/root/functions/miscellaneous/getRandomNumber.d.ts
559
- /**
560
- * Gets a random number between the given bounds.
561
- *
562
- * @category Miscellaneous
563
- *
564
- * @param lowerBound - The lowest number that can be chosen.
565
- * @param upperBound - The highest number that can be chosen.
566
- *
567
- * @returns A random number between the provided lower bound and upper bound.
568
- */
569
- declare function getRandomNumber(lowerBound: number, upperBound: number): number;
570
- //#endregion
571
- //#region src/root/functions/miscellaneous/isOrdered.d.ts
572
- /**
573
- * Checks to see if the given array is sorted in ascending order.
574
- *
575
- * @category Miscellaneous
576
- *
577
- * @param array - The array to check.
578
- *
579
- * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
580
- */
581
- declare function isOrdered(array: ReadonlyArray<number>): boolean;
582
- //#endregion
583
- //#region src/root/functions/miscellaneous/sayHello.d.ts
584
- /**
585
- * Returns a string representing the lyrics to the package's theme song, Commit To You
586
- *
587
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
588
- *
589
- * @returns The lyrics string in markdown format.
590
- */
591
- declare function sayHello(): string;
592
- //#endregion
593
- //#region src/root/functions/miscellaneous/stringifyDotenv.d.ts
594
- type QuoteStyle = "double" | "single" | "none";
595
- interface StringifyDotenvOptions {
596
- /** The quote style to use for the values (defaults to `"double"`) */
597
- quoteStyle: QuoteStyle;
598
- }
599
- /**
600
- * Converts an object into a string in .env file format.
601
- *
602
- * @param contents - The object to convert. Must be a record whose values are strings.
603
- * @param options - Extra options to apply.
604
- *
605
- * @returns A string representation of the object in .env file format.
606
- */
607
- declare function stringifyDotenv(contents: Record<RecordKey, string> | DotenvParseOutput, options?: StringifyDotenvOptions): string;
608
- //#endregion
609
- //#region src/root/functions/miscellaneous/stringListToArray.d.ts
610
- /**
611
- * Options to apply to the conversion of a string list to an array.
612
- *
613
- * @category Function Options
614
- */
615
- interface StringListToArrayOptions {
616
- /** What each item in the list is separated by. */
617
- separator?: string;
618
- /** An option to trim any extra whitespace. */
619
- trimWhitespace?: boolean;
620
- }
621
- /**
622
- * Converts a stringly-typed list to a proper array.
623
- *
624
- * @category Miscellaneous
625
- *
626
- * @param stringList - The stringly-typed list to convert.
627
- * @param options - The options to apply to the conversion.
628
- * @param options.separator - What each item in the list is separated by.
629
- * @param options.trimWhitespace - An option to trim any extra whitespace.
630
- *
631
- * @returns A new array with each item being an item from the given list.
632
- */
633
- declare function stringListToArray(stringList: string, {
634
- separator,
635
- trimWhitespace
636
- }?: StringListToArrayOptions): Array<string>;
637
- //#endregion
638
- //#region src/root/functions/miscellaneous/wait.d.ts
639
- /**
640
- * Waits for the given number of seconds
641
- *
642
- * @category Miscellaneous
643
- *
644
- * @param seconds - The number of seconds to wait.
645
- *
646
- * @returns A Promise that resolves after the given number of seconds.
647
- */
648
- declare function wait(seconds: number): Promise<void>;
649
- //#endregion
650
- //#region src/root/functions/objectHelpers/getRecordKeys.d.ts
651
- /**
652
- * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
653
- *
654
- * @category Object Helpers
655
- *
656
- * @template InputRecordType - The type of the input object.
657
- *
658
- * @param record - The record to get the keys from.
659
- *
660
- * @returns An array with all the keys of the input object in string form, but properly typed as `keyof InputRecordType`.
661
- */
662
- declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown>>(record: InputRecordType & object): Array<keyof InputRecordType>;
663
- //#endregion
664
- //#region src/root/functions/objectHelpers/omitProperties.d.ts
665
- /**
666
- * Omits properties from a given object.
667
- *
668
- * @category Object Helpers
669
- *
670
- * @template ObjectType - The type of the input object.
671
- * @template KeysToOmit - A type representing the keys to omit from the object.
672
- *
673
- * @param object - The object to omit properties from.
674
- * @param keysToOmit - The keys to omit from the object. Can either be a single string to omit one, or an array to omit multiple.
675
- *
676
- * @returns An object with a new reference in memory, with the properties omitted.
677
- */
678
- declare function omitProperties<ObjectType extends Record<string, unknown> | Readonly<Record<string, unknown>>, KeysToOmit extends keyof ObjectType>(object: ObjectType, keysToOmit: KeysToOmit | ReadonlyArray<KeysToOmit>): Omit<ObjectType, KeysToOmit>;
679
- //#endregion
680
- //#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
681
- type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
682
- /**
683
- * Removes entries whose values are `undefined` from a given object (not including null etc.).
684
- *
685
- * @param object - The object to remove undefined entries from.
686
- *
687
- * @returns An object with a new reference in memory, with undefined entries removed.
688
- */
689
- declare function removeUndefinedFromObject<RecordType extends Record<RecordKey, unknown>>(object: RecordType): RemoveUndefined<RecordType>;
690
- //#endregion
691
- //#region src/root/functions/parsers/parseBoolean.d.ts
692
- /**
693
- * Takes a stringly-typed boolean and converts it to an actual boolean type.
694
- *
695
- * @category Parsers
696
- *
697
- * @param inputString - The string to parse.
698
- *
699
- * @throws {DataError} If the string is not either `true` or `false` (case insensitive).
700
- *
701
- * @returns The string parsed as an actual boolean.
702
- */
703
- declare function parseBoolean(inputString: string): boolean;
704
- //#endregion
705
707
  //#region src/root/functions/parsers/parseEnv.d.ts
706
708
  /**
707
709
  * Represents the three common development environments.
package/dist/index.d.ts CHANGED
@@ -222,6 +222,219 @@ declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
222
222
  */
223
223
  declare function convertFileToBase64(file: File): Promise<string>;
224
224
  //#endregion
225
+ //#region src/root/functions/miscellaneous/createFormData.d.ts
226
+ type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
227
+ type FormDataArrayResolutionStrategy = "stringify" | "multiple";
228
+ /**
229
+ * Base options for resolving form data.
230
+ *
231
+ * @category Function Options
232
+ *
233
+ * @template Key - The type of the key of the input record.
234
+ */
235
+ interface CreateFormDataOptionsBase<Key extends PropertyKey> {
236
+ /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
237
+ arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
238
+ }
239
+ /**
240
+ * Options for resolving form data when it may be undefined or null, but not both.
241
+ *
242
+ * @category Function Options
243
+ *
244
+ * @template Key - The type of the key of the input record.
245
+ */
246
+ interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends PropertyKey> extends CreateFormDataOptionsBase<Key> {
247
+ /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
248
+ undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
249
+ /** How to resolve null data (May either stringify to 'null', resolve to an empty string, or omit entirely). */
250
+ nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
251
+ /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
252
+ nullableResolution?: never;
253
+ }
254
+ /**
255
+ * Options for resolving form data when it may be nullable, but not both.
256
+ *
257
+ * @category Function Options
258
+ *
259
+ * @template Key - The type of the key of the input record.
260
+ */
261
+ interface CreateFormDataOptionsNullableResolution<Key extends PropertyKey> extends CreateFormDataOptionsBase<Key> {
262
+ /** @note This must not be provided at the same time as nullableResolution. */
263
+ undefinedResolution?: never;
264
+ /** @note This must not be provided at the same time as nullableResolution. */
265
+ nullResolution?: never;
266
+ /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
267
+ nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
268
+ }
269
+ /**
270
+ * Options for resolving form data.
271
+ *
272
+ * @category Function Options
273
+ *
274
+ * @template Key - The type of the key of the input record.
275
+ */
276
+ type CreateFormDataOptions<Key extends PropertyKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
277
+ /**
278
+ * Creates FormData from a given object, resolving non-string types as appropriate.
279
+ *
280
+ * @category Miscellaneous
281
+ *
282
+ * @template DataType - The type of the given data.
283
+ *
284
+ * @param data - The data to create FormData from.
285
+ * @param options - Options to apply to the conversion.
286
+ *
287
+ * @returns A FormData object with the data applied.
288
+ */
289
+ declare function createFormData<DataType extends Record<PropertyKey, unknown>>(data: DataType, options?: CreateFormDataOptions<keyof DataType>): FormData;
290
+ //#endregion
291
+ //#region src/root/functions/miscellaneous/getRandomNumber.d.ts
292
+ /**
293
+ * Gets a random number between the given bounds.
294
+ *
295
+ * @category Miscellaneous
296
+ *
297
+ * @param lowerBound - The lowest number that can be chosen.
298
+ * @param upperBound - The highest number that can be chosen.
299
+ *
300
+ * @returns A random number between the provided lower bound and upper bound.
301
+ */
302
+ declare function getRandomNumber(lowerBound: number, upperBound: number): number;
303
+ //#endregion
304
+ //#region src/root/functions/miscellaneous/isOrdered.d.ts
305
+ /**
306
+ * Checks to see if the given array is sorted in ascending order.
307
+ *
308
+ * @category Miscellaneous
309
+ *
310
+ * @param array - The array to check.
311
+ *
312
+ * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
313
+ */
314
+ declare function isOrdered(array: ReadonlyArray<number>): boolean;
315
+ //#endregion
316
+ //#region src/root/functions/miscellaneous/sayHello.d.ts
317
+ /**
318
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
319
+ *
320
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
321
+ *
322
+ * @returns The lyrics string in markdown format.
323
+ */
324
+ declare function sayHello(): string;
325
+ //#endregion
326
+ //#region src/root/functions/miscellaneous/stringifyDotenv.d.ts
327
+ type QuoteStyle = "double" | "single" | "none";
328
+ interface StringifyDotenvOptions {
329
+ /** The quote style to use for the values (defaults to `"double"`) */
330
+ quoteStyle: QuoteStyle;
331
+ }
332
+ /**
333
+ * Converts an object into a string in .env file format.
334
+ *
335
+ * @param contents - The object to convert. Must be a record whose values are strings.
336
+ * @param options - Extra options to apply.
337
+ *
338
+ * @returns A string representation of the object in .env file format.
339
+ */
340
+ declare function stringifyDotenv(contents: Record<PropertyKey, string> | DotenvParseOutput, options?: StringifyDotenvOptions): string;
341
+ //#endregion
342
+ //#region src/root/functions/miscellaneous/stringListToArray.d.ts
343
+ /**
344
+ * Options to apply to the conversion of a string list to an array.
345
+ *
346
+ * @category Function Options
347
+ */
348
+ interface StringListToArrayOptions {
349
+ /** What each item in the list is separated by. */
350
+ separator?: string;
351
+ /** An option to trim any extra whitespace. */
352
+ trimWhitespace?: boolean;
353
+ }
354
+ /**
355
+ * Converts a stringly-typed list to a proper array.
356
+ *
357
+ * @category Miscellaneous
358
+ *
359
+ * @param stringList - The stringly-typed list to convert.
360
+ * @param options - The options to apply to the conversion.
361
+ * @param options.separator - What each item in the list is separated by.
362
+ * @param options.trimWhitespace - An option to trim any extra whitespace.
363
+ *
364
+ * @returns A new array with each item being an item from the given list.
365
+ */
366
+ declare function stringListToArray(stringList: string, {
367
+ separator,
368
+ trimWhitespace
369
+ }?: StringListToArrayOptions): Array<string>;
370
+ //#endregion
371
+ //#region src/root/functions/miscellaneous/wait.d.ts
372
+ /**
373
+ * Waits for the given number of seconds
374
+ *
375
+ * @category Miscellaneous
376
+ *
377
+ * @param seconds - The number of seconds to wait.
378
+ *
379
+ * @returns A Promise that resolves after the given number of seconds.
380
+ */
381
+ declare function wait(seconds: number): Promise<void>;
382
+ //#endregion
383
+ //#region src/root/functions/objectHelpers/getRecordKeys.d.ts
384
+ /**
385
+ * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
386
+ *
387
+ * @category Object Helpers
388
+ *
389
+ * @template InputRecordType - The type of the input object.
390
+ *
391
+ * @param record - The record to get the keys from.
392
+ *
393
+ * @returns An array with all the keys of the input object in string form, but properly typed as `keyof InputRecordType`.
394
+ */
395
+ declare function getRecordKeys<InputRecordType extends Record<PropertyKey, unknown>>(record: InputRecordType & object): Array<keyof InputRecordType>;
396
+ //#endregion
397
+ //#region src/root/functions/objectHelpers/omitProperties.d.ts
398
+ /**
399
+ * Omits properties from a given object.
400
+ *
401
+ * @category Object Helpers
402
+ *
403
+ * @template ObjectType - The type of the input object.
404
+ * @template KeysToOmit - A type representing the keys to omit from the object.
405
+ *
406
+ * @param object - The object to omit properties from.
407
+ * @param keysToOmit - The keys to omit from the object. Can either be a single string to omit one, or an array to omit multiple.
408
+ *
409
+ * @returns An object with a new reference in memory, with the properties omitted.
410
+ */
411
+ declare function omitProperties<ObjectType extends Record<string, unknown> | Readonly<Record<string, unknown>>, KeysToOmit extends keyof ObjectType>(object: ObjectType, keysToOmit: KeysToOmit | ReadonlyArray<KeysToOmit>): Omit<ObjectType, KeysToOmit>;
412
+ //#endregion
413
+ //#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
414
+ type RemoveUndefined<RecordType extends Record<PropertyKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
415
+ /**
416
+ * Removes entries whose values are `undefined` from a given object (not including null etc.).
417
+ *
418
+ * @param object - The object to remove undefined entries from.
419
+ *
420
+ * @returns An object with a new reference in memory, with undefined entries removed.
421
+ */
422
+ declare function removeUndefinedFromObject<RecordType extends Record<PropertyKey, unknown>>(object: RecordType): RemoveUndefined<RecordType>;
423
+ //#endregion
424
+ //#region src/root/functions/parsers/parseBoolean.d.ts
425
+ /**
426
+ * Takes a stringly-typed boolean and converts it to an actual boolean type.
427
+ *
428
+ * @category Parsers
429
+ *
430
+ * @param inputString - The string to parse.
431
+ *
432
+ * @throws {DataError} If the string is not either `true` or `false` (case insensitive).
433
+ *
434
+ * @returns The string parsed as an actual boolean.
435
+ */
436
+ declare function parseBoolean(inputString: string): boolean;
437
+ //#endregion
225
438
  //#region src/root/types/APIError.d.ts
226
439
  type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
227
440
  declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
@@ -248,14 +461,6 @@ declare class APIError extends Error {
248
461
  static check(input: unknown): input is APIError;
249
462
  }
250
463
  //#endregion
251
- //#region src/root/types/RecordKey.d.ts
252
- /**
253
- * Represents the native Record's possible key type.
254
- *
255
- * @category Types
256
- */
257
- type RecordKey = string | number | symbol;
258
- //#endregion
259
464
  //#region src/root/types/DataError.d.ts
260
465
  interface ExpectErrorOptions {
261
466
  expectedCode?: string;
@@ -267,7 +472,7 @@ interface ExpectErrorOptions {
267
472
  *
268
473
  * @template DataType - The type of the data that caused the error.
269
474
  */
270
- declare class DataError<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>> extends Error {
475
+ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>> extends Error {
271
476
  code: string;
272
477
  data: DataType;
273
478
  /**
@@ -285,7 +490,7 @@ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<Rec
285
490
  *
286
491
  * @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`.
287
492
  */
288
- static check<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>>(input: unknown): input is DataError<DataType>;
493
+ static check<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>(input: unknown): input is DataError<DataType>;
289
494
  /**
290
495
  * 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.
291
496
  *
@@ -411,6 +616,16 @@ declare class VersionNumber {
411
616
  }
412
617
  declare const zodVersionNumber: z$1.ZodType<VersionNumber>;
413
618
  //#endregion
619
+ //#region src/root/deprecated/RecordKey.d.ts
620
+ /**
621
+ * Represents the native Record's possible key type.
622
+ *
623
+ * @category Types
624
+ *
625
+ * @deprecated Please use the native `PropertyKey` type instead.
626
+ */
627
+ type RecordKey = string | number | symbol;
628
+ //#endregion
414
629
  //#region src/root/types/ArrayElement.d.ts
415
630
  /**
416
631
  * Gets the individual element types from an array type.
@@ -432,7 +647,7 @@ type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) =>
432
647
  *
433
648
  * @template ObjectType - The type of the object to get the value types for.
434
649
  */
435
- type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
650
+ type CreateEnumType<ObjectType extends Record<PropertyKey, unknown>> = ObjectType[keyof ObjectType];
436
651
  //#endregion
437
652
  //#region src/root/types/DisallowUndefined.d.ts
438
653
  /**
@@ -489,219 +704,6 @@ type NullableOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condit
489
704
  */
490
705
  type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condition extends true ? ResolvedTypeIfTrue : ResolvedTypeIfTrue | undefined;
491
706
  //#endregion
492
- //#region src/root/functions/miscellaneous/createFormData.d.ts
493
- type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
494
- type FormDataArrayResolutionStrategy = "stringify" | "multiple";
495
- /**
496
- * Base options for resolving form data.
497
- *
498
- * @category Function Options
499
- *
500
- * @template Key - The type of the key of the input record.
501
- */
502
- interface CreateFormDataOptionsBase<Key extends RecordKey> {
503
- /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
504
- arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
505
- }
506
- /**
507
- * Options for resolving form data when it may be undefined or null, but not both.
508
- *
509
- * @category Function Options
510
- *
511
- * @template Key - The type of the key of the input record.
512
- */
513
- interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
514
- /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
515
- undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
516
- /** How to resolve null data (May either stringify to 'null', resolve to an empty string, or omit entirely). */
517
- nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
518
- /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
519
- nullableResolution?: never;
520
- }
521
- /**
522
- * Options for resolving form data when it may be nullable, but not both.
523
- *
524
- * @category Function Options
525
- *
526
- * @template Key - The type of the key of the input record.
527
- */
528
- interface CreateFormDataOptionsNullableResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
529
- /** @note This must not be provided at the same time as nullableResolution. */
530
- undefinedResolution?: never;
531
- /** @note This must not be provided at the same time as nullableResolution. */
532
- nullResolution?: never;
533
- /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
534
- nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
535
- }
536
- /**
537
- * Options for resolving form data.
538
- *
539
- * @category Function Options
540
- *
541
- * @template Key - The type of the key of the input record.
542
- */
543
- type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
544
- /**
545
- * Creates FormData from a given object, resolving non-string types as appropriate.
546
- *
547
- * @category Miscellaneous
548
- *
549
- * @template DataType - The type of the given data.
550
- *
551
- * @param data - The data to create FormData from.
552
- * @param options - Options to apply to the conversion.
553
- *
554
- * @returns A FormData object with the data applied.
555
- */
556
- declare function createFormData<DataType extends Record<RecordKey, unknown>>(data: DataType, options?: CreateFormDataOptions<keyof DataType>): FormData;
557
- //#endregion
558
- //#region src/root/functions/miscellaneous/getRandomNumber.d.ts
559
- /**
560
- * Gets a random number between the given bounds.
561
- *
562
- * @category Miscellaneous
563
- *
564
- * @param lowerBound - The lowest number that can be chosen.
565
- * @param upperBound - The highest number that can be chosen.
566
- *
567
- * @returns A random number between the provided lower bound and upper bound.
568
- */
569
- declare function getRandomNumber(lowerBound: number, upperBound: number): number;
570
- //#endregion
571
- //#region src/root/functions/miscellaneous/isOrdered.d.ts
572
- /**
573
- * Checks to see if the given array is sorted in ascending order.
574
- *
575
- * @category Miscellaneous
576
- *
577
- * @param array - The array to check.
578
- *
579
- * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
580
- */
581
- declare function isOrdered(array: ReadonlyArray<number>): boolean;
582
- //#endregion
583
- //#region src/root/functions/miscellaneous/sayHello.d.ts
584
- /**
585
- * Returns a string representing the lyrics to the package's theme song, Commit To You
586
- *
587
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
588
- *
589
- * @returns The lyrics string in markdown format.
590
- */
591
- declare function sayHello(): string;
592
- //#endregion
593
- //#region src/root/functions/miscellaneous/stringifyDotenv.d.ts
594
- type QuoteStyle = "double" | "single" | "none";
595
- interface StringifyDotenvOptions {
596
- /** The quote style to use for the values (defaults to `"double"`) */
597
- quoteStyle: QuoteStyle;
598
- }
599
- /**
600
- * Converts an object into a string in .env file format.
601
- *
602
- * @param contents - The object to convert. Must be a record whose values are strings.
603
- * @param options - Extra options to apply.
604
- *
605
- * @returns A string representation of the object in .env file format.
606
- */
607
- declare function stringifyDotenv(contents: Record<RecordKey, string> | DotenvParseOutput, options?: StringifyDotenvOptions): string;
608
- //#endregion
609
- //#region src/root/functions/miscellaneous/stringListToArray.d.ts
610
- /**
611
- * Options to apply to the conversion of a string list to an array.
612
- *
613
- * @category Function Options
614
- */
615
- interface StringListToArrayOptions {
616
- /** What each item in the list is separated by. */
617
- separator?: string;
618
- /** An option to trim any extra whitespace. */
619
- trimWhitespace?: boolean;
620
- }
621
- /**
622
- * Converts a stringly-typed list to a proper array.
623
- *
624
- * @category Miscellaneous
625
- *
626
- * @param stringList - The stringly-typed list to convert.
627
- * @param options - The options to apply to the conversion.
628
- * @param options.separator - What each item in the list is separated by.
629
- * @param options.trimWhitespace - An option to trim any extra whitespace.
630
- *
631
- * @returns A new array with each item being an item from the given list.
632
- */
633
- declare function stringListToArray(stringList: string, {
634
- separator,
635
- trimWhitespace
636
- }?: StringListToArrayOptions): Array<string>;
637
- //#endregion
638
- //#region src/root/functions/miscellaneous/wait.d.ts
639
- /**
640
- * Waits for the given number of seconds
641
- *
642
- * @category Miscellaneous
643
- *
644
- * @param seconds - The number of seconds to wait.
645
- *
646
- * @returns A Promise that resolves after the given number of seconds.
647
- */
648
- declare function wait(seconds: number): Promise<void>;
649
- //#endregion
650
- //#region src/root/functions/objectHelpers/getRecordKeys.d.ts
651
- /**
652
- * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
653
- *
654
- * @category Object Helpers
655
- *
656
- * @template InputRecordType - The type of the input object.
657
- *
658
- * @param record - The record to get the keys from.
659
- *
660
- * @returns An array with all the keys of the input object in string form, but properly typed as `keyof InputRecordType`.
661
- */
662
- declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown>>(record: InputRecordType & object): Array<keyof InputRecordType>;
663
- //#endregion
664
- //#region src/root/functions/objectHelpers/omitProperties.d.ts
665
- /**
666
- * Omits properties from a given object.
667
- *
668
- * @category Object Helpers
669
- *
670
- * @template ObjectType - The type of the input object.
671
- * @template KeysToOmit - A type representing the keys to omit from the object.
672
- *
673
- * @param object - The object to omit properties from.
674
- * @param keysToOmit - The keys to omit from the object. Can either be a single string to omit one, or an array to omit multiple.
675
- *
676
- * @returns An object with a new reference in memory, with the properties omitted.
677
- */
678
- declare function omitProperties<ObjectType extends Record<string, unknown> | Readonly<Record<string, unknown>>, KeysToOmit extends keyof ObjectType>(object: ObjectType, keysToOmit: KeysToOmit | ReadonlyArray<KeysToOmit>): Omit<ObjectType, KeysToOmit>;
679
- //#endregion
680
- //#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
681
- type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
682
- /**
683
- * Removes entries whose values are `undefined` from a given object (not including null etc.).
684
- *
685
- * @param object - The object to remove undefined entries from.
686
- *
687
- * @returns An object with a new reference in memory, with undefined entries removed.
688
- */
689
- declare function removeUndefinedFromObject<RecordType extends Record<RecordKey, unknown>>(object: RecordType): RemoveUndefined<RecordType>;
690
- //#endregion
691
- //#region src/root/functions/parsers/parseBoolean.d.ts
692
- /**
693
- * Takes a stringly-typed boolean and converts it to an actual boolean type.
694
- *
695
- * @category Parsers
696
- *
697
- * @param inputString - The string to parse.
698
- *
699
- * @throws {DataError} If the string is not either `true` or `false` (case insensitive).
700
- *
701
- * @returns The string parsed as an actual boolean.
702
- */
703
- declare function parseBoolean(inputString: string): boolean;
704
- //#endregion
705
707
  //#region src/root/functions/parsers/parseEnv.d.ts
706
708
  /**
707
709
  * Represents the three common development environments.
@@ -1123,4 +1125,4 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1123
1125
  */
1124
1126
  declare const normalizeIndents: typeof normaliseIndents;
1125
1127
  //#endregion
1126
- export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, type RecordKey, type RemoveUndefined, type StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1128
+ export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, type RecordKey, RemoveUndefined, StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
@@ -1,12 +1,14 @@
1
1
  import { ExecaMethod } from "execa";
2
2
 
3
- //#region src/root/types/RecordKey.d.ts
3
+ //#region src/root/functions/miscellaneous/sayHello.d.ts
4
4
  /**
5
- * Represents the native Record's possible key type.
5
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
6
6
  *
7
- * @category Types
7
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
8
+ *
9
+ * @returns The lyrics string in markdown format.
8
10
  */
9
- type RecordKey = string | number | symbol;
11
+ declare function sayHello(): string;
10
12
  //#endregion
11
13
  //#region src/root/types/DataError.d.ts
12
14
  interface ExpectErrorOptions {
@@ -19,7 +21,7 @@ interface ExpectErrorOptions {
19
21
  *
20
22
  * @template DataType - The type of the data that caused the error.
21
23
  */
22
- declare class DataError<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>> extends Error {
24
+ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>> extends Error {
23
25
  code: string;
24
26
  data: DataType;
25
27
  /**
@@ -37,7 +39,7 @@ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<Rec
37
39
  *
38
40
  * @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`.
39
41
  */
40
- static check<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>>(input: unknown): input is DataError<DataType>;
42
+ static check<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>(input: unknown): input is DataError<DataType>;
41
43
  /**
42
44
  * 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.
43
45
  *
@@ -72,7 +74,7 @@ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<Rec
72
74
  *
73
75
  * @template ObjectType - The type of the object to get the value types for.
74
76
  */
75
- type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
77
+ type CreateEnumType<ObjectType extends Record<PropertyKey, unknown>> = ObjectType[keyof ObjectType];
76
78
  //#endregion
77
79
  //#region src/root/types/IsTypeArgumentString.d.ts
78
80
  type IsTypeArgumentString<Argument extends string> = Argument;
@@ -88,16 +90,6 @@ type IsTypeArgumentString<Argument extends string> = Argument;
88
90
  */
89
91
  type NullableOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condition extends true ? ResolvedTypeIfTrue : ResolvedTypeIfTrue | null;
90
92
  //#endregion
91
- //#region src/root/functions/miscellaneous/sayHello.d.ts
92
- /**
93
- * Returns a string representing the lyrics to the package's theme song, Commit To You
94
- *
95
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
96
- *
97
- * @returns The lyrics string in markdown format.
98
- */
99
- declare function sayHello(): string;
100
- //#endregion
101
93
  //#region src/internal/DependencyGroup.d.ts
102
94
  declare const DependencyGroup: {
103
95
  readonly DEPENDENCIES: "dependencies";
@@ -1,13 +1,15 @@
1
1
  import z from "zod";
2
2
  import { ExecaMethod } from "execa";
3
3
 
4
- //#region src/root/types/RecordKey.d.ts
4
+ //#region src/root/functions/miscellaneous/sayHello.d.ts
5
5
  /**
6
- * Represents the native Record's possible key type.
6
+ * Returns a string representing the lyrics to the package's theme song, Commit To You
7
7
  *
8
- * @category Types
8
+ * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
9
+ *
10
+ * @returns The lyrics string in markdown format.
9
11
  */
10
- type RecordKey = string | number | symbol;
12
+ declare function sayHello(): string;
11
13
  //#endregion
12
14
  //#region src/root/types/DataError.d.ts
13
15
  interface ExpectErrorOptions {
@@ -20,7 +22,7 @@ interface ExpectErrorOptions {
20
22
  *
21
23
  * @template DataType - The type of the data that caused the error.
22
24
  */
23
- declare class DataError<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>> extends Error {
25
+ declare class DataError<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>> extends Error {
24
26
  code: string;
25
27
  data: DataType;
26
28
  /**
@@ -38,7 +40,7 @@ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<Rec
38
40
  *
39
41
  * @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`.
40
42
  */
41
- static check<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>>(input: unknown): input is DataError<DataType>;
43
+ static check<DataType extends Record<PropertyKey, unknown> = Record<PropertyKey, unknown>>(input: unknown): input is DataError<DataType>;
42
44
  /**
43
45
  * 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.
44
46
  *
@@ -73,7 +75,7 @@ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<Rec
73
75
  *
74
76
  * @template ObjectType - The type of the object to get the value types for.
75
77
  */
76
- type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
78
+ type CreateEnumType<ObjectType extends Record<PropertyKey, unknown>> = ObjectType[keyof ObjectType];
77
79
  //#endregion
78
80
  //#region src/root/types/IsTypeArgumentString.d.ts
79
81
  type IsTypeArgumentString<Argument extends string> = Argument;
@@ -89,16 +91,6 @@ type IsTypeArgumentString<Argument extends string> = Argument;
89
91
  */
90
92
  type NullableOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condition extends true ? ResolvedTypeIfTrue : ResolvedTypeIfTrue | null;
91
93
  //#endregion
92
- //#region src/root/functions/miscellaneous/sayHello.d.ts
93
- /**
94
- * Returns a string representing the lyrics to the package's theme song, Commit To You
95
- *
96
- * [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
97
- *
98
- * @returns The lyrics string in markdown format.
99
- */
100
- declare function sayHello(): string;
101
- //#endregion
102
94
  //#region src/internal/DependencyGroup.d.ts
103
95
  declare const DependencyGroup: {
104
96
  readonly DEPENDENCIES: "dependencies";
@@ -52,9 +52,6 @@ interface FilePathData {
52
52
  */
53
53
  declare function parseFilePath(filePath: string): FilePathData;
54
54
  //#endregion
55
- //#region src/root/types/IsTypeArgumentString.d.ts
56
- type IsTypeArgumentString<Argument extends string> = Argument;
57
- //#endregion
58
55
  //#region src/root/functions/miscellaneous/sayHello.d.ts
59
56
  /**
60
57
  * Returns a string representing the lyrics to the package's theme song, Commit To You
@@ -65,4 +62,7 @@ type IsTypeArgumentString<Argument extends string> = Argument;
65
62
  */
66
63
  declare function sayHello(): string;
67
64
  //#endregion
65
+ //#region src/root/types/IsTypeArgumentString.d.ts
66
+ type IsTypeArgumentString<Argument extends string> = Argument;
67
+ //#endregion
68
68
  export { IsTypeArgumentString, normaliseImportPath, normalizeImportPath, parseFilePath, sayHello };
@@ -54,9 +54,6 @@ interface FilePathData {
54
54
  */
55
55
  declare function parseFilePath(filePath: string): FilePathData;
56
56
  //#endregion
57
- //#region src/root/types/IsTypeArgumentString.d.ts
58
- type IsTypeArgumentString<Argument extends string> = Argument;
59
- //#endregion
60
57
  //#region src/root/functions/miscellaneous/sayHello.d.ts
61
58
  /**
62
59
  * Returns a string representing the lyrics to the package's theme song, Commit To You
@@ -67,4 +64,7 @@ type IsTypeArgumentString<Argument extends string> = Argument;
67
64
  */
68
65
  declare function sayHello(): string;
69
66
  //#endregion
67
+ //#region src/root/types/IsTypeArgumentString.d.ts
68
+ type IsTypeArgumentString<Argument extends string> = Argument;
69
+ //#endregion
70
70
  export { type IsTypeArgumentString, normaliseImportPath, normalizeImportPath, parseFilePath, sayHello };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "5.6.5",
3
+ "version": "5.7.0",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",