@alextheman/utility 5.6.1 → 5.6.3

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.ts CHANGED
@@ -1,4 +1,4 @@
1
- import z, { ZodError, ZodType, z as z$1 } from "zod";
1
+ import z$1, { ZodError, ZodType, z } from "zod";
2
2
  import { DotenvParseOutput } from "dotenv";
3
3
 
4
4
  //#region src/root/constants/FILE_PATH_REGEX.d.ts
@@ -30,7 +30,7 @@ declare const VERSION_NUMBER_REGEX: RegExp;
30
30
  *
31
31
  * @returns A Promise resolving to an array of the callback results.
32
32
  */
33
- declare function fillArray<ItemType>(callback: (index: number) => Promise<ItemType>, length?: number): Promise<ItemType[]>;
33
+ declare function fillArray<ItemType>(callback: (index: number) => Promise<ItemType>, length?: number): Promise<Array<ItemType>>;
34
34
  /**
35
35
  * Creates a new array where each element is the result of the provided synchronous callback.
36
36
  *
@@ -44,7 +44,7 @@ declare function fillArray<ItemType>(callback: (index: number) => Promise<ItemTy
44
44
  *
45
45
  * @returns An array of the callback results.
46
46
  */
47
- declare function fillArray<ItemType>(callback: (index: number) => ItemType, length?: number): ItemType[];
47
+ declare function fillArray<ItemType>(callback: (index: number) => ItemType, length?: number): Array<ItemType>;
48
48
  //#endregion
49
49
  //#region src/root/functions/arrayHelpers/paralleliseArrays.d.ts
50
50
  type ParallelTuple<A, B> = [A, B | undefined];
@@ -64,7 +64,7 @@ type ParallelTuple<A, B> = [A, B | undefined];
64
64
  *
65
65
  * @returns An array of `[firstItem, secondItem]` tuples for each index in `firstArray`.
66
66
  */
67
- declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: readonly FirstArrayItem[], secondArray: readonly SecondArrayItem[]): ParallelTuple<FirstArrayItem, SecondArrayItem>[];
67
+ declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: ReadonlyArray<FirstArrayItem>, secondArray: ReadonlyArray<SecondArrayItem>): Array<ParallelTuple<FirstArrayItem, SecondArrayItem>>;
68
68
  //#endregion
69
69
  //#region src/root/functions/arrayHelpers/randomiseArray.d.ts
70
70
  /**
@@ -78,7 +78,7 @@ declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray:
78
78
  *
79
79
  * @returns A new array with the items randomised.
80
80
  */
81
- declare function randomiseArray<ItemType>(array: ItemType[]): ItemType[];
81
+ declare function randomiseArray<ItemType>(array: Array<ItemType>): Array<ItemType>;
82
82
  //#endregion
83
83
  //#region src/root/functions/arrayHelpers/range.d.ts
84
84
  /**
@@ -98,7 +98,7 @@ declare function randomiseArray<ItemType>(array: ItemType[]): ItemType[];
98
98
  *
99
99
  * @returns An array of numbers satisfying the range provided.
100
100
  */
101
- declare function range(start: number, stop: number, step?: number): number[];
101
+ declare function range(start: number, stop: number, step?: number): Array<number>;
102
102
  //#endregion
103
103
  //#region src/root/functions/arrayHelpers/removeDuplicates.d.ts
104
104
  /**
@@ -112,7 +112,7 @@ declare function range(start: number, stop: number, step?: number): number[];
112
112
  *
113
113
  * @returns A new array with a different reference in memory, with the duplicates removed.
114
114
  */
115
- declare function removeDuplicates<ItemType>(array: ItemType[] | readonly ItemType[]): ItemType[];
115
+ declare function removeDuplicates<ItemType>(array: Array<ItemType> | ReadonlyArray<ItemType>): Array<ItemType>;
116
116
  //#endregion
117
117
  //#region src/root/functions/date/addDaysToDate.d.ts
118
118
  /**
@@ -409,7 +409,7 @@ declare class VersionNumber {
409
409
  */
410
410
  toString(): string;
411
411
  }
412
- declare const zodVersionNumber: z.ZodType<VersionNumber>;
412
+ declare const zodVersionNumber: z$1.ZodType<VersionNumber>;
413
413
  //#endregion
414
414
  //#region src/root/types/ArrayElement.d.ts
415
415
  /**
@@ -419,7 +419,7 @@ declare const zodVersionNumber: z.ZodType<VersionNumber>;
419
419
  *
420
420
  * @template ArrayType - The type of the array itself.
421
421
  */
422
- type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
422
+ type ArrayElement<ArrayType extends ReadonlyArray<unknown>> = ArrayType extends ReadonlyArray<infer ElementType> ? ElementType : never;
423
423
  //#endregion
424
424
  //#region src/root/types/CallReturnType.d.ts
425
425
  type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) => infer Return) ? Return : never;
@@ -578,7 +578,7 @@ declare function getRandomNumber(lowerBound: number, upperBound: number): number
578
578
  *
579
579
  * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
580
580
  */
581
- declare function isOrdered(array: readonly number[]): boolean;
581
+ declare function isOrdered(array: ReadonlyArray<number>): boolean;
582
582
  //#endregion
583
583
  //#region src/root/functions/miscellaneous/sayHello.d.ts
584
584
  /**
@@ -633,7 +633,7 @@ interface StringListToArrayOptions {
633
633
  declare function stringListToArray(stringList: string, {
634
634
  separator,
635
635
  trimWhitespace
636
- }?: StringListToArrayOptions): string[];
636
+ }?: StringListToArrayOptions): Array<string>;
637
637
  //#endregion
638
638
  //#region src/root/functions/miscellaneous/wait.d.ts
639
639
  /**
@@ -659,7 +659,7 @@ declare function wait(seconds: number): Promise<void>;
659
659
  *
660
660
  * @returns An array with all the keys of the input object in string form, but properly typed as `keyof InputRecordType`.
661
661
  */
662
- declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown>>(record: InputRecordType & object): (keyof InputRecordType)[];
662
+ declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown>>(record: InputRecordType & object): Array<keyof InputRecordType>;
663
663
  //#endregion
664
664
  //#region src/root/functions/objectHelpers/omitProperties.d.ts
665
665
  /**
@@ -675,7 +675,7 @@ declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown
675
675
  *
676
676
  * @returns An object with a new reference in memory, with the properties omitted.
677
677
  */
678
- declare function omitProperties<ObjectType extends Record<string, unknown> | Readonly<Record<string, unknown>>, KeysToOmit extends keyof ObjectType>(object: ObjectType, keysToOmit: KeysToOmit | readonly KeysToOmit[]): Omit<ObjectType, KeysToOmit>;
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
679
  //#endregion
680
680
  //#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
681
681
  type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
@@ -821,7 +821,7 @@ declare function parseVersionType(input: unknown): VersionType;
821
821
  *
822
822
  * @returns The parsed data from the Zod schema.
823
823
  */
824
- declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z$1.infer<SchemaType>;
824
+ declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z.infer<SchemaType>;
825
825
  //#endregion
826
826
  //#region src/root/functions/parsers/zod/parseZodSchemaAsync.d.ts
827
827
  /**
@@ -840,7 +840,7 @@ declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Er
840
840
  *
841
841
  * @returns The parsed data from the Zod schema.
842
842
  */
843
- declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z$1.infer<SchemaType>>;
843
+ declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z.infer<SchemaType>>;
844
844
  //#endregion
845
845
  //#region src/root/functions/recursive/deepCopy.d.ts
846
846
  /**
@@ -965,7 +965,7 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
965
965
  *
966
966
  * @returns A template strings array that can be passed as the first argument of any tagged template function.
967
967
  */
968
- declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
968
+ declare function createTemplateStringsArray(strings: ReadonlyArray<string>): TemplateStringsArray;
969
969
  //#endregion
970
970
  //#region src/root/functions/taggedTemplate/getStringsAndInterpolations.d.ts
971
971
  /**
@@ -997,7 +997,7 @@ declare function createTemplateStringsArray(strings: readonly string[]): Templat
997
997
  * interpolate(...getStringsAndInterpolations`The package ${packageName} uses the ${packageManager} package manager.`);
998
998
  * ```
999
999
  */
1000
- declare function getStringsAndInterpolations<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): [TemplateStringsArray, ...InterpolationsType];
1000
+ declare function getStringsAndInterpolations<const InterpolationsType extends ReadonlyArray<unknown>>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): [TemplateStringsArray, ...InterpolationsType];
1001
1001
  //#endregion
1002
1002
  //#region src/root/functions/taggedTemplate/interpolate.d.ts
1003
1003
  /**
@@ -1020,7 +1020,7 @@ declare function getStringsAndInterpolations<const InterpolationsType extends re
1020
1020
  *
1021
1021
  * @returns A new string with the strings and interpolations from the template applied.
1022
1022
  */
1023
- declare function interpolate<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
1023
+ declare function interpolate<const InterpolationsType extends ReadonlyArray<unknown>>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
1024
1024
  //#endregion
1025
1025
  //#region src/root/functions/taggedTemplate/interpolateObjects.d.ts
1026
1026
  /**
@@ -1041,7 +1041,7 @@ declare function interpolate<const InterpolationsType extends readonly unknown[]
1041
1041
  *
1042
1042
  * @returns A new string with the strings and interpolations from the template applied, with objects stringified.
1043
1043
  */
1044
- declare function interpolateObjects<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
1044
+ declare function interpolateObjects<const InterpolationsType extends ReadonlyArray<unknown>>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
1045
1045
  //#endregion
1046
1046
  //#region src/root/functions/taggedTemplate/isTemplateStringsArray.d.ts
1047
1047
  /**
@@ -1066,7 +1066,7 @@ interface NormaliseIndentsOptions {
1066
1066
  preserveTabs?: boolean;
1067
1067
  }
1068
1068
  type NormalizeIndentsOptions = NormaliseIndentsOptions;
1069
- type NormaliseIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
1069
+ type NormaliseIndentsFunction = (strings: TemplateStringsArray, ...interpolations: Array<unknown>) => string;
1070
1070
  type NormalizeIndentsFunction = NormaliseIndentsFunction;
1071
1071
  /**
1072
1072
  * Provides a new function that removes any extraneous indents from a multi-line template string, with the given options applied.
@@ -1096,7 +1096,7 @@ declare function normaliseIndents(options: NormaliseIndentsOptions): NormaliseIn
1096
1096
  *
1097
1097
  * @returns A new string with the strings and interpolations from the template applied, and extraneous indents removed.
1098
1098
  */
1099
- declare function normaliseIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
1099
+ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolations: Array<unknown>): string;
1100
1100
  /**
1101
1101
  * Applies any options if provided, then removes any extraneous indents from a multi-line template string.
1102
1102
  *
package/dist/index.js CHANGED
@@ -1,24 +1,19 @@
1
- import z, { z as z$1 } from "zod";
1
+ import z$1, { z } from "zod";
2
2
  import sodium from "libsodium-wrappers";
3
-
4
3
  //#region src/root/constants/FILE_PATH_REGEX.ts
5
4
  const FILE_PATH_PATTERN = String.raw`(?<directory>.+)[\/\\](?<base>[^\/\\]+)`;
6
5
  const FILE_PATH_REGEX = RegExp(`^${FILE_PATH_PATTERN}$`);
7
-
8
6
  //#endregion
9
7
  //#region src/root/constants/ONE_DAY_IN_MILLISECONDS.ts
10
8
  const ONE_DAY_IN_MILLISECONDS = 1440 * 60 * 1e3;
11
-
12
9
  //#endregion
13
10
  //#region src/root/constants/UUID_REGEX.ts
14
11
  const UUID_PATTERN = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
15
12
  const UUID_REGEX = new RegExp(`^${UUID_PATTERN}$`);
16
-
17
13
  //#endregion
18
14
  //#region src/root/constants/VERSION_NUMBER_REGEX.ts
19
15
  const VERSION_NUMBER_PATTERN = String.raw`^(?:v)?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$`;
20
16
  const VERSION_NUMBER_REGEX = RegExp(`^${VERSION_NUMBER_PATTERN}$`);
21
-
22
17
  //#endregion
23
18
  //#region src/root/functions/arrayHelpers/fillArray.ts
24
19
  /**
@@ -45,7 +40,6 @@ function fillArray(callback, length = 1) {
45
40
  })) return Promise.all(outputArray);
46
41
  return outputArray;
47
42
  }
48
-
49
43
  //#endregion
50
44
  //#region src/root/functions/arrayHelpers/paralleliseArrays.ts
51
45
  /**
@@ -69,7 +63,6 @@ function paralleliseArrays(firstArray, secondArray) {
69
63
  for (let i = 0; i < firstArray.length; i++) outputArray.push([firstArray[i], secondArray[i]]);
70
64
  return outputArray;
71
65
  }
72
-
73
66
  //#endregion
74
67
  //#region src/root/types/APIError.ts
75
68
  const httpErrorCodeLookup = {
@@ -113,7 +106,6 @@ var APIError = class APIError extends Error {
113
106
  return typeof data === "object" && data !== null && typeof data?.status === "number" && typeof data?.message === "string";
114
107
  }
115
108
  };
116
-
117
109
  //#endregion
118
110
  //#region src/root/types/DataError.ts
119
111
  /**
@@ -203,7 +195,6 @@ var DataError = class DataError extends Error {
203
195
  throw new Error("Expected a DataError to be thrown but none was thrown");
204
196
  }
205
197
  };
206
-
207
198
  //#endregion
208
199
  //#region src/root/types/VersionNumber.ts
209
200
  /**
@@ -228,7 +219,7 @@ var VersionNumber = class VersionNumber {
228
219
  this.minor = input.minor;
229
220
  this.patch = input.patch;
230
221
  } else if (typeof input === "string") {
231
- if (!RegExp(VERSION_NUMBER_REGEX).test(input)) throw new DataError({ input }, "INVALID_VERSION", `"${input}" is not a valid version number. Version numbers must be of the format "X.Y.Z" or "vX.Y.Z", where X, Y, and Z are non-negative integers.`);
222
+ if (!VERSION_NUMBER_REGEX.test(input)) throw new DataError({ input }, "INVALID_VERSION", `"${input}" is not a valid version number. Version numbers must be of the format "X.Y.Z" or "vX.Y.Z", where X, Y, and Z are non-negative integers.`);
232
223
  const [major, minor, patch] = VersionNumber.formatString(input, { omitPrefix: true }).split(".").map((number) => {
233
224
  return parseIntStrict(number);
234
225
  });
@@ -245,7 +236,10 @@ var VersionNumber = class VersionNumber {
245
236
  this.major = major;
246
237
  this.minor = minor;
247
238
  this.patch = patch;
248
- }
239
+ } else throw new DataError({ input }, "INVALID_INPUT", normaliseIndents`
240
+ The provided input can not be parsed into a valid version number.
241
+ Expected either a string of format X.Y.Z or vX.Y.Z, a tuple of three numbers, or another \`VersionNumber\` instance.
242
+ `);
249
243
  }
250
244
  /**
251
245
  * Gets the current version type of the current instance of `VersionNumber`.
@@ -357,18 +351,17 @@ var VersionNumber = class VersionNumber {
357
351
  return VersionNumber.formatString(rawString, { omitPrefix: false });
358
352
  }
359
353
  };
360
- const zodVersionNumber = z.union([
361
- z.string(),
362
- z.tuple([
363
- z.number(),
364
- z.number(),
365
- z.number()
354
+ const zodVersionNumber = z$1.union([
355
+ z$1.string(),
356
+ z$1.tuple([
357
+ z$1.number(),
358
+ z$1.number(),
359
+ z$1.number()
366
360
  ]),
367
- z.instanceof(VersionNumber)
361
+ z$1.instanceof(VersionNumber)
368
362
  ]).transform((rawVersionNumber) => {
369
363
  return new VersionNumber(rawVersionNumber);
370
364
  });
371
-
372
365
  //#endregion
373
366
  //#region src/root/functions/parsers/parseIntStrict.ts
374
367
  /**
@@ -390,7 +383,7 @@ function parseIntStrict(string, radix) {
390
383
  string,
391
384
  radix
392
385
  } : { string }, "INTEGER_PARSING_ERROR", `Only numeric values${radix && radix > 10 && radix <= 36 ? ` or character${radix !== 11 ? "s" : ""} A${radix !== 11 ? `-${maxAllowedAlphabeticalCharacter?.toUpperCase()} ` : " "}` : " "}are allowed.`);
393
- if (radix && radix < 10 && [...trimmedString].some((character) => {
386
+ if (radix && radix < 10 && [...trimmedString.replace(/^[+-]/, "")].some((character) => {
394
387
  return parseInt(character) >= radix;
395
388
  })) throw new DataError({
396
389
  string,
@@ -400,7 +393,6 @@ function parseIntStrict(string, radix) {
400
393
  if (isNaN(parseIntResult)) throw new DataError({ string }, "INTEGER_PARSING_ERROR", "Value is not a valid integer.");
401
394
  return parseIntResult;
402
395
  }
403
-
404
396
  //#endregion
405
397
  //#region src/root/functions/miscellaneous/getRandomNumber.ts
406
398
  /**
@@ -418,7 +410,6 @@ function getRandomNumber(lowerBound, upperBound) {
418
410
  const parsedUpperBound = parseIntStrict(`${upperBound}`);
419
411
  return Math.floor(Math.random() * (parsedUpperBound - parsedLowerBound + 1) + parsedLowerBound);
420
412
  }
421
-
422
413
  //#endregion
423
414
  //#region src/root/functions/arrayHelpers/randomiseArray.ts
424
415
  /**
@@ -441,7 +432,6 @@ function randomiseArray(array) {
441
432
  } while (mutableArray.length > 0);
442
433
  return outputArray;
443
434
  }
444
-
445
435
  //#endregion
446
436
  //#region src/root/functions/arrayHelpers/range.ts
447
437
  /**
@@ -481,7 +471,6 @@ function range(start, stop, step = 1) {
481
471
  }
482
472
  return numbers;
483
473
  }
484
-
485
474
  //#endregion
486
475
  //#region src/root/functions/arrayHelpers/removeDuplicates.ts
487
476
  /**
@@ -500,7 +489,6 @@ function removeDuplicates(array) {
500
489
  for (const item of array) if (!outputArray.includes(item)) outputArray.push(item);
501
490
  return outputArray;
502
491
  }
503
-
504
492
  //#endregion
505
493
  //#region src/root/functions/date/addDaysToDate.ts
506
494
  /**
@@ -518,7 +506,6 @@ function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement =
518
506
  newDate.setDate(newDate.getDate() + dayIncrement);
519
507
  return newDate;
520
508
  }
521
-
522
509
  //#endregion
523
510
  //#region src/root/functions/date/calculateMonthlyDifference.ts
524
511
  /**
@@ -533,7 +520,6 @@ function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement =
533
520
  function calculateMonthlyDifference(firstDate, secondDate) {
534
521
  return firstDate.getMonth() - secondDate.getMonth();
535
522
  }
536
-
537
523
  //#endregion
538
524
  //#region src/root/functions/date/isSameDate.ts
539
525
  /**
@@ -549,7 +535,6 @@ function calculateMonthlyDifference(firstDate, secondDate) {
549
535
  function isSameDate(firstDate, secondDate) {
550
536
  return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth() && firstDate.getFullYear() === secondDate.getFullYear();
551
537
  }
552
-
553
538
  //#endregion
554
539
  //#region src/root/functions/date/formatDateAndTime.ts
555
540
  /**
@@ -573,7 +558,6 @@ function formatDateAndTime(inputDate) {
573
558
  if (isSameDate(inputDate, today)) return `Today at ${inputTime}`;
574
559
  return `${inputDate.getDate().toString().padStart(2, "0")}/${(inputDate.getMonth() + 1).toString().padStart(2, "0")}/${inputDate.getFullYear().toString()}, ${inputTime}`;
575
560
  }
576
-
577
561
  //#endregion
578
562
  //#region src/root/functions/date/isLeapYear.ts
579
563
  /**
@@ -591,7 +575,6 @@ function isLeapYear(year) {
591
575
  const parsedYear = parseIntStrict(`${year}`);
592
576
  return parsedYear % 4 === 0 && parsedYear % 100 !== 0 || parsedYear % 400 === 0;
593
577
  }
594
-
595
578
  //#endregion
596
579
  //#region src/root/functions/date/isAnniversary.ts
597
580
  function checkLeapYear(firstDate, secondDate) {
@@ -612,7 +595,6 @@ function isAnniversary(firstDate, secondDate) {
612
595
  if (checkLeapYear(firstDate, secondDate) || checkLeapYear(secondDate, firstDate)) return true;
613
596
  return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth();
614
597
  }
615
-
616
598
  //#endregion
617
599
  //#region src/root/functions/date/isMonthlyMultiple.ts
618
600
  function endOfMonthChecksButNotFebruary(firstDate, secondDate) {
@@ -661,7 +643,6 @@ function isMonthlyMultiple(firstDate, secondDate) {
661
643
  if (leapYearFebruaryChecks(firstDate, secondDate) || leapYearFebruaryChecks(secondDate, firstDate)) return true;
662
644
  return firstDate.getDate() === secondDate.getDate();
663
645
  }
664
-
665
646
  //#endregion
666
647
  //#region src/root/functions/miscellaneous/convertFileToBase64.ts
667
648
  /**
@@ -691,7 +672,6 @@ function convertFileToBase64(file) {
691
672
  };
692
673
  });
693
674
  }
694
-
695
675
  //#endregion
696
676
  //#region src/root/functions/miscellaneous/createFormData.ts
697
677
  function getNullableResolutionStrategy(key, strategy) {
@@ -763,7 +743,6 @@ function createFormData(data, options = {
763
743
  } else formData.append(String(key), String(value));
764
744
  return formData;
765
745
  }
766
-
767
746
  //#endregion
768
747
  //#region src/root/functions/miscellaneous/isOrdered.ts
769
748
  /**
@@ -781,7 +760,6 @@ function isOrdered(array) {
781
760
  for (const index in newArray) if (newArray[index] !== array[index]) return false;
782
761
  return true;
783
762
  }
784
-
785
763
  //#endregion
786
764
  //#region src/root/functions/recursive/deepFreeze.ts
787
765
  /**
@@ -805,7 +783,6 @@ function deepFreeze(object) {
805
783
  }
806
784
  return Object.freeze(object);
807
785
  }
808
-
809
786
  //#endregion
810
787
  //#region src/root/functions/taggedTemplate/createTemplateStringsArray.ts
811
788
  /**
@@ -820,7 +797,6 @@ function deepFreeze(object) {
820
797
  function createTemplateStringsArray(strings) {
821
798
  return deepFreeze(Object.assign([...strings], { raw: [...strings] }));
822
799
  }
823
-
824
800
  //#endregion
825
801
  //#region src/root/functions/taggedTemplate/getStringsAndInterpolations.ts
826
802
  /**
@@ -861,7 +837,6 @@ function getStringsAndInterpolations(strings, ...interpolations) {
861
837
  }, "INVALID_STRINGS_AND_INTERPOLATIONS_LENGTH", "The length of the strings must be exactly one more than the length of the interpolations.");
862
838
  return [createTemplateStringsArray(strings), ...interpolations];
863
839
  }
864
-
865
840
  //#endregion
866
841
  //#region src/root/functions/taggedTemplate/interpolate.ts
867
842
  /**
@@ -889,7 +864,6 @@ function interpolate(strings, ...interpolations) {
889
864
  for (const [string, interpolation = ""] of paralleliseArrays(strings, interpolations)) result += string + interpolation;
890
865
  return result;
891
866
  }
892
-
893
867
  //#endregion
894
868
  //#region src/root/functions/taggedTemplate/interpolateObjects.ts
895
869
  /**
@@ -918,7 +892,6 @@ function interpolateObjects(strings, ...interpolations) {
918
892
  }
919
893
  return result;
920
894
  }
921
-
922
895
  //#endregion
923
896
  //#region src/root/functions/taggedTemplate/isTemplateStringsArray.ts
924
897
  /**
@@ -933,7 +906,6 @@ function interpolateObjects(strings, ...interpolations) {
933
906
  function isTemplateStringsArray(input) {
934
907
  return typeof input === "object" && input !== null && "raw" in input;
935
908
  }
936
-
937
909
  //#endregion
938
910
  //#region src/root/functions/taggedTemplate/normaliseIndents.ts
939
911
  function calculateTabSize(line, whitespaceLength) {
@@ -1022,7 +994,6 @@ function normaliseIndents(first, ...args) {
1022
994
  * @returns An additional function to invoke, or a new string with the strings and interpolations from the template applied, and extraneous indents removed.
1023
995
  */
1024
996
  const normalizeIndents = normaliseIndents;
1025
-
1026
997
  //#endregion
1027
998
  //#region src/root/functions/miscellaneous/sayHello.ts
1028
999
  /**
@@ -1136,7 +1107,6 @@ function sayHello() {
1136
1107
  I'll commit to you!
1137
1108
  `;
1138
1109
  }
1139
-
1140
1110
  //#endregion
1141
1111
  //#region src/root/functions/miscellaneous/stringifyDotenv.ts
1142
1112
  /**
@@ -1172,7 +1142,6 @@ function stringifyDotenv(contents, options) {
1172
1142
  }
1173
1143
  return result;
1174
1144
  }
1175
-
1176
1145
  //#endregion
1177
1146
  //#region src/root/functions/miscellaneous/stringListToArray.ts
1178
1147
  /**
@@ -1194,7 +1163,6 @@ function stringListToArray(stringList, { separator = ",", trimWhitespace = true
1194
1163
  return item.trim();
1195
1164
  }) : arrayList;
1196
1165
  }
1197
-
1198
1166
  //#endregion
1199
1167
  //#region src/root/functions/miscellaneous/wait.ts
1200
1168
  /**
@@ -1213,7 +1181,6 @@ function wait(seconds) {
1213
1181
  }, seconds * 1e3);
1214
1182
  });
1215
1183
  }
1216
-
1217
1184
  //#endregion
1218
1185
  //#region src/root/functions/objectHelpers/getRecordKeys.ts
1219
1186
  /**
@@ -1230,7 +1197,6 @@ function wait(seconds) {
1230
1197
  function getRecordKeys(record) {
1231
1198
  return Object.keys(record);
1232
1199
  }
1233
-
1234
1200
  //#endregion
1235
1201
  //#region src/root/functions/objectHelpers/omitProperties.ts
1236
1202
  /**
@@ -1253,7 +1219,6 @@ function omitProperties(object, keysToOmit) {
1253
1219
  });
1254
1220
  return outputObject;
1255
1221
  }
1256
-
1257
1222
  //#endregion
1258
1223
  //#region src/root/functions/objectHelpers/removeUndefinedFromObject.ts
1259
1224
  /**
@@ -1268,7 +1233,6 @@ function removeUndefinedFromObject(object) {
1268
1233
  return value !== void 0;
1269
1234
  }));
1270
1235
  }
1271
-
1272
1236
  //#endregion
1273
1237
  //#region src/root/functions/parsers/parseBoolean.ts
1274
1238
  /**
@@ -1287,7 +1251,6 @@ function parseBoolean(inputString) {
1287
1251
  if (!["true", "false"].includes(normalisedString)) throw new DataError({ inputString }, "INVALID_BOOLEAN_STRING", "The provided boolean string must be one of `true | false`");
1288
1252
  return normalisedString === "true";
1289
1253
  }
1290
-
1291
1254
  //#endregion
1292
1255
  //#region src/root/functions/parsers/zod/_parseZodSchema.ts
1293
1256
  function _parseZodSchema(parsedResult, input, onError) {
@@ -1308,11 +1271,10 @@ function _parseZodSchema(parsedResult, input, onError) {
1308
1271
  return secondCount - firstCount;
1309
1272
  }).map(([code, count], _, allErrorCodes) => {
1310
1273
  return allErrorCodes.length === 1 && count === 1 ? code : `${code}×${count}`;
1311
- }).join(","), `\n\n${z.prettifyError(parsedResult.error)}\n`);
1274
+ }).join(","), `\n\n${z$1.prettifyError(parsedResult.error)}\n`);
1312
1275
  }
1313
1276
  return parsedResult.data;
1314
1277
  }
1315
-
1316
1278
  //#endregion
1317
1279
  //#region src/root/functions/parsers/zod/parseZodSchema.ts
1318
1280
  /**
@@ -1336,7 +1298,6 @@ function _parseZodSchema(parsedResult, input, onError) {
1336
1298
  function parseZodSchema(schema, input, onError) {
1337
1299
  return _parseZodSchema(schema.safeParse(input), input, onError);
1338
1300
  }
1339
-
1340
1301
  //#endregion
1341
1302
  //#region src/root/functions/parsers/parseEnv.ts
1342
1303
  /**
@@ -1361,9 +1322,8 @@ const Env = {
1361
1322
  * @returns The specified environment if allowed.
1362
1323
  */
1363
1324
  function parseEnv(input) {
1364
- return parseZodSchema(z$1.enum(Env), input, new DataError({ input }, "INVALID_ENV", "The provided environment type must be one of `test | development | production`"));
1325
+ return parseZodSchema(z.enum(Env), input, new DataError({ input }, "INVALID_ENV", "The provided environment type must be one of `test | development | production`"));
1365
1326
  }
1366
-
1367
1327
  //#endregion
1368
1328
  //#region src/root/functions/parsers/parseFormData.ts
1369
1329
  /**
@@ -1386,7 +1346,6 @@ function parseFormData(formData, dataParser) {
1386
1346
  if (dataParser) return dataParser(object);
1387
1347
  return object;
1388
1348
  }
1389
-
1390
1349
  //#endregion
1391
1350
  //#region src/root/functions/parsers/parseUUID.ts
1392
1351
  /**
@@ -1405,7 +1364,6 @@ function parseUUID(input) {
1405
1364
  if (!UUID_REGEX.test(input)) throw new DataError({ input }, "INVALID_UUID", "The provided input does not match the expected shape for a UUID.");
1406
1365
  return input;
1407
1366
  }
1408
-
1409
1367
  //#endregion
1410
1368
  //#region src/root/functions/parsers/parseVersionType.ts
1411
1369
  /**
@@ -1430,9 +1388,8 @@ const VersionType = {
1430
1388
  * @returns The given version type if allowed.
1431
1389
  */
1432
1390
  function parseVersionType(input) {
1433
- return parseZodSchema(z.enum(VersionType), input, new DataError({ input }, "INVALID_VERSION_TYPE", "The provided version type must be one of `major | minor | patch`"));
1391
+ return parseZodSchema(z$1.enum(VersionType), input, new DataError({ input }, "INVALID_VERSION_TYPE", "The provided version type must be one of `major | minor | patch`"));
1434
1392
  }
1435
-
1436
1393
  //#endregion
1437
1394
  //#region src/root/functions/parsers/zod/parseZodSchemaAsync.ts
1438
1395
  /**
@@ -1454,7 +1411,6 @@ function parseVersionType(input) {
1454
1411
  async function parseZodSchemaAsync(schema, input, onError) {
1455
1412
  return _parseZodSchema(await schema.safeParseAsync(input), input, onError);
1456
1413
  }
1457
-
1458
1414
  //#endregion
1459
1415
  //#region src/root/functions/recursive/deepCopy.ts
1460
1416
  function callDeepCopy(input) {
@@ -1482,7 +1438,6 @@ function deepCopy(object) {
1482
1438
  }
1483
1439
  return clonedObject;
1484
1440
  }
1485
-
1486
1441
  //#endregion
1487
1442
  //#region src/root/functions/security/encryptWithKey.ts
1488
1443
  /**
@@ -1503,7 +1458,6 @@ async function encryptWithKey(publicKey, plaintextValue) {
1503
1458
  throw new DataError({ publicKey }, "ENCRYPTION_FAILED", "Encryption failed. Please double-check that the given key is a valid base 64 string.");
1504
1459
  }
1505
1460
  }
1506
-
1507
1461
  //#endregion
1508
1462
  //#region src/root/functions/stringHelpers/appendSemicolon.ts
1509
1463
  /**
@@ -1523,7 +1477,6 @@ function appendSemicolon(stringToAppendTo) {
1523
1477
  if (stringWithNoTrailingWhitespace === "") return "";
1524
1478
  return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
1525
1479
  }
1526
-
1527
1480
  //#endregion
1528
1481
  //#region src/root/functions/stringHelpers/camelToKebab.ts
1529
1482
  /**
@@ -1562,7 +1515,6 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
1562
1515
  }
1563
1516
  return result;
1564
1517
  }
1565
-
1566
1518
  //#endregion
1567
1519
  //#region src/root/functions/stringHelpers/kebabToCamel.ts
1568
1520
  /**
@@ -1602,7 +1554,6 @@ function kebabToCamel(input, options) {
1602
1554
  }
1603
1555
  return outputString;
1604
1556
  }
1605
-
1606
1557
  //#endregion
1607
1558
  //#region src/root/functions/stringHelpers/truncate.ts
1608
1559
  /**
@@ -1618,6 +1569,5 @@ function kebabToCamel(input, options) {
1618
1569
  function truncate(stringToTruncate, maxLength = 5) {
1619
1570
  return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
1620
1571
  }
1621
-
1622
1572
  //#endregion
1623
- export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, 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 };
1573
+ export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, 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 };