@alextheman/utility 4.17.0 → 5.0.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.ts CHANGED
@@ -1,17 +1,16 @@
1
1
  import z, { ZodError, ZodType, z as z$1 } from "zod";
2
- import sodium from "libsodium-wrappers";
3
2
  import { DotenvParseOutput } from "dotenv";
4
3
 
5
- //#region src/constants/FILE_PATH_REGEX.d.ts
4
+ //#region src/root/constants/FILE_PATH_REGEX.d.ts
6
5
  declare const FILE_PATH_REGEX: string;
7
6
  //#endregion
8
- //#region src/constants/NAMESPACE_EXPORT_REGEX.d.ts
7
+ //#region src/root/constants/NAMESPACE_EXPORT_REGEX.d.ts
9
8
  declare const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
10
9
  //#endregion
11
- //#region src/constants/VERSION_NUMBER_REGEX.d.ts
10
+ //#region src/root/constants/VERSION_NUMBER_REGEX.d.ts
12
11
  declare const VERSION_NUMBER_REGEX: string;
13
12
  //#endregion
14
- //#region src/functions/arrayHelpers/fillArray.d.ts
13
+ //#region src/root/functions/arrayHelpers/fillArray.d.ts
15
14
  /**
16
15
  * Creates a new array where each element is the resolved result of the provided asynchronous callback.
17
16
  *
@@ -41,7 +40,7 @@ declare function fillArray<ItemType>(callback: (index: number) => Promise<ItemTy
41
40
  */
42
41
  declare function fillArray<ItemType>(callback: (index: number) => ItemType, length?: number): ItemType[];
43
42
  //#endregion
44
- //#region src/functions/arrayHelpers/paralleliseArrays.d.ts
43
+ //#region src/root/functions/arrayHelpers/paralleliseArrays.d.ts
45
44
  type ParallelTuple<A, B> = [A, B | undefined];
46
45
  /**
47
46
  * Creates a new array of tuples, each containing the item at the given index from both arrays.
@@ -61,7 +60,7 @@ type ParallelTuple<A, B> = [A, B | undefined];
61
60
  */
62
61
  declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: readonly FirstArrayItem[], secondArray: readonly SecondArrayItem[]): ParallelTuple<FirstArrayItem, SecondArrayItem>[];
63
62
  //#endregion
64
- //#region src/functions/arrayHelpers/randomiseArray.d.ts
63
+ //#region src/root/functions/arrayHelpers/randomiseArray.d.ts
65
64
  /**
66
65
  * Randomises the order of a given array and returns the result in a new array without mutating the original.
67
66
  *
@@ -75,7 +74,7 @@ declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray:
75
74
  */
76
75
  declare function randomiseArray<ItemType>(array: ItemType[]): ItemType[];
77
76
  //#endregion
78
- //#region src/functions/arrayHelpers/range.d.ts
77
+ //#region src/root/functions/arrayHelpers/range.d.ts
79
78
  /**
80
79
  * Creates an array of numbers within a given range.
81
80
  *
@@ -95,7 +94,7 @@ declare function randomiseArray<ItemType>(array: ItemType[]): ItemType[];
95
94
  */
96
95
  declare function range(start: number, stop: number, step?: number): number[];
97
96
  //#endregion
98
- //#region src/functions/arrayHelpers/removeDuplicates.d.ts
97
+ //#region src/root/functions/arrayHelpers/removeDuplicates.d.ts
99
98
  /**
100
99
  * Removes duplicate values from an array.
101
100
  *
@@ -109,7 +108,7 @@ declare function range(start: number, stop: number, step?: number): number[];
109
108
  */
110
109
  declare function removeDuplicates<ItemType>(array: ItemType[] | readonly ItemType[]): ItemType[];
111
110
  //#endregion
112
- //#region src/functions/date/addDaysToDate.d.ts
111
+ //#region src/root/functions/date/addDaysToDate.d.ts
113
112
  /**
114
113
  * Adds a given number of days to the provided date, returning the result as a new instance of Date.
115
114
  *
@@ -122,7 +121,7 @@ declare function removeDuplicates<ItemType>(array: ItemType[] | readonly ItemTyp
122
121
  */
123
122
  declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
124
123
  //#endregion
125
- //#region src/functions/date/formatDateAndTime.d.ts
124
+ //#region src/root/functions/date/formatDateAndTime.d.ts
126
125
  /**
127
126
  * Creates a human-readable string with information about the input date.
128
127
  *
@@ -138,7 +137,7 @@ declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
138
137
  */
139
138
  declare function formatDateAndTime(inputDate: Date): string;
140
139
  //#endregion
141
- //#region src/functions/date/isAnniversary.d.ts
140
+ //#region src/root/functions/date/isAnniversary.d.ts
142
141
  /**
143
142
  * Checks if the provided dates are exactly a whole number of years apart.
144
143
  *
@@ -151,7 +150,7 @@ declare function formatDateAndTime(inputDate: Date): string;
151
150
  */
152
151
  declare function isAnniversary(firstDate: Date, secondDate: Date): boolean;
153
152
  //#endregion
154
- //#region src/functions/date/isLeapYear.d.ts
153
+ //#region src/root/functions/date/isLeapYear.d.ts
155
154
  /**
156
155
  * Checks if the provided year is a leap year.
157
156
  *
@@ -165,7 +164,7 @@ declare function isAnniversary(firstDate: Date, secondDate: Date): boolean;
165
164
  */
166
165
  declare function isLeapYear(year: number): boolean;
167
166
  //#endregion
168
- //#region src/functions/date/isMonthlyMultiple.d.ts
167
+ //#region src/root/functions/date/isMonthlyMultiple.d.ts
169
168
  /**
170
169
  * Checks if the provided dates are exactly a whole number of months apart.
171
170
  *
@@ -178,7 +177,7 @@ declare function isLeapYear(year: number): boolean;
178
177
  */
179
178
  declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
180
179
  //#endregion
181
- //#region src/functions/date/isSameDate.d.ts
180
+ //#region src/root/functions/date/isSameDate.d.ts
182
181
  /**
183
182
  * Checks if the provided dates happen on the exact same day, month, and year.
184
183
  *
@@ -191,7 +190,7 @@ declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
191
190
  */
192
191
  declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
193
192
  //#endregion
194
- //#region src/functions/miscellaneous/convertFileToBase64.d.ts
193
+ //#region src/root/functions/miscellaneous/convertFileToBase64.d.ts
195
194
  /**
196
195
  * Asynchronously converts a file to a base 64 string
197
196
  *
@@ -205,7 +204,7 @@ declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
205
204
  */
206
205
  declare function convertFileToBase64(file: File): Promise<string>;
207
206
  //#endregion
208
- //#region src/types/APIError.d.ts
207
+ //#region src/root/types/APIError.d.ts
209
208
  type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
210
209
  declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
211
210
  /**
@@ -231,22 +230,32 @@ declare class APIError extends Error {
231
230
  static check(input: unknown): input is APIError;
232
231
  }
233
232
  //#endregion
234
- //#region src/types/DataError.d.ts
233
+ //#region src/root/types/RecordKey.d.ts
234
+ /**
235
+ * Represents the native Record's possible key type.
236
+ *
237
+ * @category Types
238
+ */
239
+ type RecordKey = string | number | symbol;
240
+ //#endregion
241
+ //#region src/root/types/DataError.d.ts
235
242
  /**
236
243
  * Represents errors you may get that may've been caused by a specific piece of data.
237
244
  *
238
245
  * @category Types
246
+ *
247
+ * @template DataType - The type of the data that caused the error.
239
248
  */
240
- declare class DataError extends Error {
249
+ declare class DataError<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>> extends Error {
241
250
  code: string;
242
- data: unknown;
251
+ data: DataType;
243
252
  /**
244
253
  * @param data - The data that caused the error.
245
254
  * @param code - A standardised code (e.g. UNEXPECTED_DATA).
246
255
  * @param message - A human-readable error message (e.g. The data provided is invalid).
247
256
  * @param options - Extra options to pass to super Error constructor.
248
257
  */
249
- constructor(data: unknown, code?: string, message?: string, options?: ErrorOptions);
258
+ constructor(data: DataType, code?: string, message?: string, options?: ErrorOptions);
250
259
  /**
251
260
  * Checks whether the given input may have been caused by a DataError.
252
261
  *
@@ -254,19 +263,32 @@ declare class DataError extends Error {
254
263
  *
255
264
  * @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`.
256
265
  */
257
- static check(input: unknown): input is DataError;
266
+ static check<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>>(input: unknown): input is DataError<DataType>;
258
267
  }
259
268
  //#endregion
260
- //#region src/types/VersionNumber.d.ts
269
+ //#region src/root/types/VersionNumber.d.ts
261
270
  /**
262
271
  * Options to apply to the stringification of the version number.
263
272
  *
264
273
  * @category Class Options
265
274
  */
266
- interface VersionNumberToStringOptions {
275
+ interface FormatOptionsBase {
267
276
  /** Whether you want to omit the "v" prefix or not (defaults to false). */
268
277
  omitPrefix?: boolean;
269
278
  }
279
+ interface FormatOptionsIncludeMinor extends FormatOptionsBase {
280
+ /** Whether you want to omit the minor version or not */
281
+ omitMinor?: false;
282
+ /** Whether you want to omit the patch version or not */
283
+ omitPatch?: boolean;
284
+ }
285
+ interface FormatOptionsOmitMinor extends FormatOptionsBase {
286
+ /** Whether you want to omit the minor version or not */
287
+ omitMinor?: true;
288
+ /** Whether you want to omit the patch version or not */
289
+ omitPatch?: never;
290
+ }
291
+ type FormatStringOptions = FormatOptionsIncludeMinor | FormatOptionsOmitMinor;
270
292
  /**
271
293
  * Represents a software version number, considered to be made up of a major, minor, and patch part.
272
294
  *
@@ -300,6 +322,14 @@ declare class VersionNumber {
300
322
  * @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
301
323
  */
302
324
  static isEqual(firstVersion: VersionNumber, secondVersion: VersionNumber): boolean;
325
+ /**
326
+ * Get a formatted string representation of the current version number
327
+ *
328
+ * @param options - Options to apply to the string formatting.
329
+ *
330
+ * @returns A formatted string representation of the current version number with the options applied.
331
+ */
332
+ format(options?: FormatStringOptions): string;
303
333
  /**
304
334
  * Increments the current version number by the given increment type, returning the result as a new reference in memory.
305
335
  *
@@ -329,15 +359,13 @@ declare class VersionNumber {
329
359
  /**
330
360
  * Get a string representation of the current version number.
331
361
  *
332
- * @param options - Extra additional options to apply.
333
- *
334
- * @returns A stringified representation of the current version number, leaving out the prefix if `omitPrefix` option was set to true.
362
+ * @returns A stringified representation of the current version number with the prefix.
335
363
  */
336
- toString(options?: VersionNumberToStringOptions): string;
364
+ toString(): string;
337
365
  }
338
366
  declare const zodVersionNumber: z.ZodType<VersionNumber>;
339
367
  //#endregion
340
- //#region src/types/ArrayElement.d.ts
368
+ //#region src/root/types/ArrayElement.d.ts
341
369
  /**
342
370
  * Gets the individual element types from an array type.
343
371
  *
@@ -347,18 +375,10 @@ declare const zodVersionNumber: z.ZodType<VersionNumber>;
347
375
  */
348
376
  type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
349
377
  //#endregion
350
- //#region src/types/CallReturnType.d.ts
378
+ //#region src/root/types/CallReturnType.d.ts
351
379
  type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) => infer Return) ? Return : never;
352
380
  //#endregion
353
- //#region src/types/RecordKey.d.ts
354
- /**
355
- * Represents the native Record's possible key type.
356
- *
357
- * @category Types
358
- */
359
- type RecordKey = string | number | symbol;
360
- //#endregion
361
- //#region src/types/CreateEnumType.d.ts
381
+ //#region src/root/types/CreateEnumType.d.ts
362
382
  /**
363
383
  * Get the value types from a const object so the object can behave similarly to an enum.
364
384
  *
@@ -368,7 +388,7 @@ type RecordKey = string | number | symbol;
368
388
  */
369
389
  type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
370
390
  //#endregion
371
- //#region src/types/DisallowUndefined.d.ts
391
+ //#region src/root/types/DisallowUndefined.d.ts
372
392
  /**
373
393
  * Resolves to an error message type if the type argument could potentially be undefined.
374
394
  *
@@ -378,7 +398,7 @@ type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[
378
398
  */
379
399
  type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Generic type cannot include undefined"] : InputType;
380
400
  //#endregion
381
- //#region src/types/IgnoreCase.d.ts
401
+ //#region src/root/types/IgnoreCase.d.ts
382
402
  /**
383
403
  * Allows case-insensitive variants of a known string type.
384
404
  *
@@ -388,10 +408,10 @@ type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Gener
388
408
  */
389
409
  type IgnoreCase<StringType extends string> = string extends StringType ? string : StringType extends `${infer FirstCharacter}${infer SecondCharacter}${infer Remainder}` ? `${Uppercase<FirstCharacter> | Lowercase<FirstCharacter>}${Uppercase<SecondCharacter> | Lowercase<SecondCharacter>}${IgnoreCase<Remainder>}` : StringType extends `${infer FirstCharacter}${infer Remainder}` ? `${Uppercase<FirstCharacter> | Lowercase<FirstCharacter>}${IgnoreCase<Remainder>}` : "";
390
410
  //#endregion
391
- //#region src/types/IsTypeArgumentString.d.ts
411
+ //#region src/root/types/IsTypeArgumentString.d.ts
392
412
  type IsTypeArgumentString<Argument extends string> = Argument;
393
413
  //#endregion
394
- //#region src/types/NonUndefined.d.ts
414
+ //#region src/root/types/NonUndefined.d.ts
395
415
  /**
396
416
  * Resolves to `never` if the given type may be undefined.
397
417
  *
@@ -401,7 +421,7 @@ type IsTypeArgumentString<Argument extends string> = Argument;
401
421
  */
402
422
  type NonUndefined<InputType> = InputType extends undefined ? never : InputType;
403
423
  //#endregion
404
- //#region src/types/OptionalOnCondition.d.ts
424
+ //#region src/root/types/OptionalOnCondition.d.ts
405
425
  /**
406
426
  * Resolves to the given type if the first type is `true`, otherwise resolves to `undefined`
407
427
  *
@@ -412,7 +432,7 @@ type NonUndefined<InputType> = InputType extends undefined ? never : InputType;
412
432
  */
413
433
  type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condition extends true ? ResolvedTypeIfTrue : ResolvedTypeIfTrue | undefined;
414
434
  //#endregion
415
- //#region src/functions/miscellaneous/createFormData.d.ts
435
+ //#region src/root/functions/miscellaneous/createFormData.d.ts
416
436
  type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
417
437
  type FormDataArrayResolutionStrategy = "stringify" | "multiple";
418
438
  /**
@@ -478,7 +498,25 @@ type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefin
478
498
  */
479
499
  declare function createFormData<DataType extends Record<RecordKey, unknown>>(data: DataType, options?: CreateFormDataOptions<keyof DataType>): FormData;
480
500
  //#endregion
481
- //#region src/functions/miscellaneous/getRandomNumber.d.ts
501
+ //#region src/root/functions/miscellaneous/getDependenciesFromGroup.d.ts
502
+ declare const DependencyGroup: {
503
+ readonly DEPENDENCIES: "dependencies";
504
+ readonly DEV_DEPENDENCIES: "devDependencies";
505
+ };
506
+ type DependencyGroup = CreateEnumType<typeof DependencyGroup>;
507
+ /**
508
+ * Get the dependencies from a given dependency group in `package.json`.
509
+ *
510
+ * @category Miscellaneous
511
+ *
512
+ * @param packageInfo - The data coming from `package.json`.
513
+ * @param dependencyGroup - The group to get dependency information about (can be `dependencies` or `devDependencies`).
514
+ *
515
+ * @returns A record consisting of the package names and version ranges from the given dependency group.
516
+ */
517
+ declare function getDependenciesFromGroup(packageInfo: Record<string, unknown>, dependencyGroup: DependencyGroup): Record<string, string>;
518
+ //#endregion
519
+ //#region src/root/functions/miscellaneous/getRandomNumber.d.ts
482
520
  /**
483
521
  * Gets a random number between the given bounds.
484
522
  *
@@ -491,7 +529,7 @@ declare function createFormData<DataType extends Record<RecordKey, unknown>>(dat
491
529
  */
492
530
  declare function getRandomNumber(lowerBound: number, upperBound: number): number;
493
531
  //#endregion
494
- //#region src/functions/miscellaneous/isOrdered.d.ts
532
+ //#region src/root/functions/miscellaneous/isOrdered.d.ts
495
533
  /**
496
534
  * Checks to see if the given array is sorted in ascending order.
497
535
  *
@@ -503,7 +541,7 @@ declare function getRandomNumber(lowerBound: number, upperBound: number): number
503
541
  */
504
542
  declare function isOrdered(array: readonly number[]): boolean;
505
543
  //#endregion
506
- //#region src/functions/miscellaneous/sayHello.d.ts
544
+ //#region src/root/functions/miscellaneous/sayHello.d.ts
507
545
  /**
508
546
  * Returns a string representing the lyrics to the package's theme song, Commit To You
509
547
  *
@@ -513,7 +551,7 @@ declare function isOrdered(array: readonly number[]): boolean;
513
551
  */
514
552
  declare function sayHello(): string;
515
553
  //#endregion
516
- //#region src/functions/miscellaneous/stringifyDotenv.d.ts
554
+ //#region src/root/functions/miscellaneous/stringifyDotenv.d.ts
517
555
  type QuoteStyle = "double" | "single" | "none";
518
556
  interface StringifyDotenvOptions {
519
557
  /** The quote style to use for the values (defaults to `"double"`) */
@@ -529,7 +567,7 @@ interface StringifyDotenvOptions {
529
567
  */
530
568
  declare function stringifyDotenv(contents: Record<RecordKey, string> | DotenvParseOutput, options?: StringifyDotenvOptions): string;
531
569
  //#endregion
532
- //#region src/functions/miscellaneous/stringListToArray.d.ts
570
+ //#region src/root/functions/miscellaneous/stringListToArray.d.ts
533
571
  /**
534
572
  * Options to apply to the conversion of a string list to an array.
535
573
  *
@@ -558,7 +596,7 @@ declare function stringListToArray(stringList: string, {
558
596
  trimWhitespace
559
597
  }?: StringListToArrayOptions): string[];
560
598
  //#endregion
561
- //#region src/functions/miscellaneous/wait.d.ts
599
+ //#region src/root/functions/miscellaneous/wait.d.ts
562
600
  /**
563
601
  * Waits for the given number of seconds
564
602
  *
@@ -570,7 +608,7 @@ declare function stringListToArray(stringList: string, {
570
608
  */
571
609
  declare function wait(seconds: number): Promise<void>;
572
610
  //#endregion
573
- //#region src/functions/objectHelpers/getRecordKeys.d.ts
611
+ //#region src/root/functions/objectHelpers/getRecordKeys.d.ts
574
612
  /**
575
613
  * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
576
614
  *
@@ -584,7 +622,7 @@ declare function wait(seconds: number): Promise<void>;
584
622
  */
585
623
  declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown>>(record: InputRecordType & object): (keyof InputRecordType)[];
586
624
  //#endregion
587
- //#region src/functions/objectHelpers/omitProperties.d.ts
625
+ //#region src/root/functions/objectHelpers/omitProperties.d.ts
588
626
  /**
589
627
  * Omits properties from a given object.
590
628
  *
@@ -600,7 +638,7 @@ declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown
600
638
  */
601
639
  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>;
602
640
  //#endregion
603
- //#region src/functions/objectHelpers/removeUndefinedFromObject.d.ts
641
+ //#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
604
642
  type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
605
643
  /**
606
644
  * Removes entries whose values are `undefined` from a given object (not including null etc.).
@@ -611,7 +649,7 @@ type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in
611
649
  */
612
650
  declare function removeUndefinedFromObject<RecordType extends Record<RecordKey, unknown>>(object: RecordType): RemoveUndefined<RecordType>;
613
651
  //#endregion
614
- //#region src/functions/parsers/parseBoolean.d.ts
652
+ //#region src/root/functions/parsers/parseBoolean.d.ts
615
653
  /**
616
654
  * Takes a stringly-typed boolean and converts it to an actual boolean type.
617
655
  *
@@ -625,7 +663,7 @@ declare function removeUndefinedFromObject<RecordType extends Record<RecordKey,
625
663
  */
626
664
  declare function parseBoolean(inputString: string): boolean;
627
665
  //#endregion
628
- //#region src/functions/parsers/parseEnv.d.ts
666
+ //#region src/root/functions/parsers/parseEnv.d.ts
629
667
  /**
630
668
  * Represents the three common development environments.
631
669
  *
@@ -642,15 +680,15 @@ type Env = CreateEnumType<typeof Env>;
642
680
  *
643
681
  * @category Parsers
644
682
  *
645
- * @param data - The data to parse.
683
+ * @param input - The data to parse.
646
684
  *
647
685
  * @throws {DataError} If the data does not match one of the environments allowed by the Env types ("test" | "development" | "production").
648
686
  *
649
687
  * @returns The specified environment if allowed.
650
688
  */
651
- declare function parseEnv(data: unknown): Env;
689
+ declare function parseEnv(input: unknown): Env;
652
690
  //#endregion
653
- //#region src/functions/parsers/parseFilePath.d.ts
691
+ //#region src/root/functions/parsers/parseFilePath.d.ts
654
692
  interface FilePathData {
655
693
  /** The file path without the final part. */
656
694
  directory: string;
@@ -672,7 +710,7 @@ interface FilePathData {
672
710
  */
673
711
  declare function parseFilePath(filePath: string): FilePathData;
674
712
  //#endregion
675
- //#region src/functions/parsers/parseFormData.d.ts
713
+ //#region src/root/functions/parsers/parseFormData.d.ts
676
714
  /**
677
715
  * Returns a parsed object given FormData and a data parser function to call on the resulting object.
678
716
  *
@@ -693,7 +731,7 @@ declare function parseFormData<DataType>(formData: FormData, dataParser: (data:
693
731
  */
694
732
  declare function parseFormData(formData: FormData): Record<string, string | Blob>;
695
733
  //#endregion
696
- //#region src/functions/parsers/parseIntStrict.d.ts
734
+ //#region src/root/functions/parsers/parseIntStrict.d.ts
697
735
  /**
698
736
  * Converts a string to an integer and throws an error if it cannot be converted.
699
737
  *
@@ -708,7 +746,7 @@ declare function parseFormData(formData: FormData): Record<string, string | Blob
708
746
  */
709
747
  declare function parseIntStrict(string: string, radix?: number): number;
710
748
  //#endregion
711
- //#region src/functions/parsers/parseVersionType.d.ts
749
+ //#region src/root/functions/parsers/parseVersionType.d.ts
712
750
  /**
713
751
  * Represents the three common software version types.
714
752
  *
@@ -725,15 +763,15 @@ type VersionType = CreateEnumType<typeof VersionType>;
725
763
  *
726
764
  * @category Parsers
727
765
  *
728
- * @param data - The data to parse.
766
+ * @param input - The data to parse.
729
767
  *
730
768
  * @throws {DataError} If the data does not match one of the allowed version types (`"major" | "minor" | "patch"`).
731
769
  *
732
770
  * @returns The given version type if allowed.
733
771
  */
734
- declare function parseVersionType(data: unknown): VersionType;
772
+ declare function parseVersionType(input: unknown): VersionType;
735
773
  //#endregion
736
- //#region src/functions/parsers/zod/parseZodSchema.d.ts
774
+ //#region src/root/functions/parsers/zod/parseZodSchema.d.ts
737
775
  /**
738
776
  * An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
739
777
  *
@@ -745,16 +783,16 @@ declare function parseVersionType(data: unknown): VersionType;
745
783
  * @template ErrorType - The type of error to throw on invalid data.
746
784
  *
747
785
  * @param schema - The Zod schema to use in parsing.
748
- * @param data - The data to parse.
786
+ * @param input - The data to parse.
749
787
  * @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
750
788
  *
751
789
  * @throws {DataError} If the given data cannot be parsed according to the schema.
752
790
  *
753
791
  * @returns The parsed data from the Zod schema.
754
792
  */
755
- declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z$1.infer<SchemaType>;
793
+ declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, input: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): z$1.infer<SchemaType>;
756
794
  //#endregion
757
- //#region src/functions/parsers/zod/parseZodSchemaAsync.d.ts
795
+ //#region src/root/functions/parsers/zod/parseZodSchemaAsync.d.ts
758
796
  /**
759
797
  * An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
760
798
  *
@@ -764,16 +802,16 @@ declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Er
764
802
  * @template ErrorType - The type of error to throw on invalid data.
765
803
  *
766
804
  * @param schema - The Zod schema to use in parsing.
767
- * @param data - The data to parse.
805
+ * @param input - The data to parse.
768
806
  * @param onError - A custom error to throw on invalid data (defaults to `DataError`). May either be the error itself, or a function that returns the error or nothing. If nothing is returned, the default error is thrown instead.
769
807
  *
770
808
  * @throws {DataError} If the given data cannot be parsed according to the schema.
771
809
  *
772
810
  * @returns The parsed data from the Zod schema.
773
811
  */
774
- declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType, data: unknown, onError?: ErrorType | ((zodError: ZodError) => ErrorType | void)): Promise<z$1.infer<SchemaType>>;
812
+ 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>>;
775
813
  //#endregion
776
- //#region src/functions/recursive/deepCopy.d.ts
814
+ //#region src/root/functions/recursive/deepCopy.d.ts
777
815
  /**
778
816
  * Deeply copies an object or array such that all child objects/arrays are also copied.
779
817
  *
@@ -787,7 +825,7 @@ declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType exten
787
825
  */
788
826
  declare function deepCopy<ObjectType extends object>(object: ObjectType): ObjectType;
789
827
  //#endregion
790
- //#region src/functions/recursive/deepFreeze.d.ts
828
+ //#region src/root/functions/recursive/deepFreeze.d.ts
791
829
  /**
792
830
  * Deeply freezes an object or array such that all child objects/arrays are also frozen.
793
831
  *
@@ -804,7 +842,7 @@ declare function deepCopy<ObjectType extends object>(object: ObjectType): Object
804
842
  */
805
843
  declare function deepFreeze<ObjectType extends object>(object: ObjectType): Readonly<ObjectType>;
806
844
  //#endregion
807
- //#region src/functions/security/encryptWithKey.d.ts
845
+ //#region src/root/functions/security/encryptWithKey.d.ts
808
846
  /**
809
847
  * Encrypt a secret given the public base64 key and the thing you want to encrypt.
810
848
  *
@@ -815,57 +853,7 @@ declare function deepFreeze<ObjectType extends object>(object: ObjectType): Read
815
853
  */
816
854
  declare function encryptWithKey(publicKey: string, plaintextValue: string): Promise<string>;
817
855
  //#endregion
818
- //#region src/functions/security/getPublicAndPrivateKey.d.ts
819
- interface PublicAndPrivateKey<KeyType extends Uint8Array | string> {
820
- /** The generated public key from libsodium */
821
- publicKey: KeyType;
822
- /** The generated private key from libsodium */
823
- privateKey: KeyType;
824
- /** The key type from libsodium */
825
- keyType: ReturnType<typeof sodium.crypto_box_keypair>["keyType"];
826
- }
827
- /**
828
- * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
829
- *
830
- * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
831
- *
832
- * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
833
- *
834
- * @returns An object containing both the publicKey and privateKey, along with a keyType.
835
- *
836
- * Because you have not provided an `outputFormat`, the keys will be typed as `Uint8Array`.
837
- */
838
- declare function getPublicAndPrivateKey(): PublicAndPrivateKey<Uint8Array>;
839
- /**
840
- * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
841
- *
842
- * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
843
- *
844
- * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
845
- *
846
- * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
847
- *
848
- * @returns An object containing both the publicKey and privateKey, along with a keyType.
849
- *
850
- * Because you provided an `outputFormat` of `uint8array`, the keys will be typed as `Uint8Array`.
851
- */
852
- declare function getPublicAndPrivateKey(outputFormat: "uint8array"): PublicAndPrivateKey<Uint8Array>;
853
- /**
854
- * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
855
- *
856
- * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
857
- *
858
- * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
859
- *
860
- * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
861
- *
862
- * @returns An object containing both the publicKey and privateKey, along with a keyType.
863
- *
864
- * Because you provided an `outputFormat` of either `text`, `hex` or `base64`, the keys will be typed as `string`.
865
- */
866
- declare function getPublicAndPrivateKey(outputFormat: "text" | "hex" | "base64"): PublicAndPrivateKey<string>;
867
- //#endregion
868
- //#region src/functions/stringHelpers/appendSemicolon.d.ts
856
+ //#region src/root/functions/stringHelpers/appendSemicolon.d.ts
869
857
  /**
870
858
  * Appends a semicolon to the end of a string, trimming where necessary first.
871
859
  *
@@ -879,7 +867,7 @@ declare function getPublicAndPrivateKey(outputFormat: "text" | "hex" | "base64")
879
867
  */
880
868
  declare function appendSemicolon(stringToAppendTo: string): string;
881
869
  //#endregion
882
- //#region src/functions/stringHelpers/camelToKebab.d.ts
870
+ //#region src/root/functions/stringHelpers/camelToKebab.d.ts
883
871
  /**
884
872
  * Options to apply to the conversion from camelCase to kebab-case
885
873
  *
@@ -901,7 +889,7 @@ interface CamelToKebabOptions {
901
889
  */
902
890
  declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
903
891
  //#endregion
904
- //#region src/functions/stringHelpers/kebabToCamel.d.ts
892
+ //#region src/root/functions/stringHelpers/kebabToCamel.d.ts
905
893
  /**
906
894
  * Options to apply to the conversion from kebab-case to camelCase
907
895
  *
@@ -923,39 +911,7 @@ interface KebabToCamelOptions {
923
911
  */
924
912
  declare function kebabToCamel(string: string, options?: KebabToCamelOptions): string;
925
913
  //#endregion
926
- //#region src/functions/stringHelpers/normalizeImportPath.d.ts
927
- /**
928
- * Normalizes an import path meant for use in an import statement in JavaScript.
929
- * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. If the path is a zero-length string, '.' is returned, representing the current working directory.
930
- *
931
- * If the path starts with ./, it is preserved (unlike what would happen with path.posix.normalize() normally).
932
- *
933
- * Helpful for custom linter rules that need to check (or fix) import paths.
934
- *
935
- * @category String Helpers
936
- *
937
- * @param importPath - The import path to normalize.
938
- *
939
- * @returns The import path normalized.
940
- */
941
- declare function normalizeImportPath(importPath: string): string;
942
- /**
943
- * Normalises an import path meant for use in an import statement in JavaScript.
944
- * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. If the path is a zero-length string, '.' is returned, representing the current working directory.
945
- *
946
- * If the path starts with ./, it is preserved (unlike what would happen with path.posix.normalize() normally).
947
- *
948
- * Helpful for custom linter rules that need to check (or fix) import paths.
949
- *
950
- * @category String Helpers
951
- *
952
- * @param importPath - The import path to normalise.
953
- *
954
- * @returns The import path normalised.
955
- */
956
- declare const normaliseImportPath: typeof normalizeImportPath;
957
- //#endregion
958
- //#region src/functions/stringHelpers/truncate.d.ts
914
+ //#region src/root/functions/stringHelpers/truncate.d.ts
959
915
  /**
960
916
  * Truncates a string and appends `...` to the end of it
961
917
  *
@@ -968,7 +924,7 @@ declare const normaliseImportPath: typeof normalizeImportPath;
968
924
  */
969
925
  declare function truncate(stringToTruncate: string, maxLength?: number): string;
970
926
  //#endregion
971
- //#region src/functions/taggedTemplate/createTemplateStringsArray.d.ts
927
+ //#region src/root/functions/taggedTemplate/createTemplateStringsArray.d.ts
972
928
  /**
973
929
  * Creates a template strings array given a regular array of strings
974
930
  *
@@ -980,28 +936,7 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
980
936
  */
981
937
  declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
982
938
  //#endregion
983
- //#region src/functions/taggedTemplate/getInterpolations.d.ts
984
- /**
985
- *
986
- * Gets the strings and interpolations separately from a template string.
987
- * You can pass a template string directly by doing:
988
- *
989
- * ```typescript
990
- * getInterpolations`Template string here`.
991
- * ```
992
- *
993
- * @category Tagged Template
994
- *
995
- * @deprecated Please use `getStringsAndInterpolations` instead.
996
- *
997
- * @param strings - The strings from the template to process.
998
- * @param interpolations - An array of all interpolations from the template.
999
- *
1000
- * @returns A tuple where the first item is the strings from the template, and the second is the interpolations.
1001
- */
1002
- declare function getInterpolations(strings: TemplateStringsArray, ...interpolations: unknown[]): [TemplateStringsArray, unknown[]];
1003
- //#endregion
1004
- //#region src/functions/taggedTemplate/getStringsAndInterpolations.d.ts
939
+ //#region src/root/functions/taggedTemplate/getStringsAndInterpolations.d.ts
1005
940
  /**
1006
941
  *
1007
942
  * Gets the strings and interpolations separately from a template string.
@@ -1033,7 +968,7 @@ declare function getInterpolations(strings: TemplateStringsArray, ...interpolati
1033
968
  */
1034
969
  declare function getStringsAndInterpolations<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): [TemplateStringsArray, ...InterpolationsType];
1035
970
  //#endregion
1036
- //#region src/functions/taggedTemplate/interpolate.d.ts
971
+ //#region src/root/functions/taggedTemplate/interpolate.d.ts
1037
972
  /**
1038
973
  * Returns the result of interpolating a template string when given the strings and interpolations separately.
1039
974
  *
@@ -1056,7 +991,7 @@ declare function getStringsAndInterpolations<const InterpolationsType extends re
1056
991
  */
1057
992
  declare function interpolate<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
1058
993
  //#endregion
1059
- //#region src/functions/taggedTemplate/interpolateObjects.d.ts
994
+ //#region src/root/functions/taggedTemplate/interpolateObjects.d.ts
1060
995
  /**
1061
996
  * Returns the result of interpolating a template string, also stringifying objects.
1062
997
  *
@@ -1077,7 +1012,7 @@ declare function interpolate<const InterpolationsType extends readonly unknown[]
1077
1012
  */
1078
1013
  declare function interpolateObjects<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
1079
1014
  //#endregion
1080
- //#region src/functions/taggedTemplate/isTemplateStringsArray.d.ts
1015
+ //#region src/root/functions/taggedTemplate/isTemplateStringsArray.d.ts
1081
1016
  /**
1082
1017
  * Determines whether or not the input is a valid `TemplateStringsArray`.
1083
1018
  *
@@ -1089,7 +1024,7 @@ declare function interpolateObjects<const InterpolationsType extends readonly un
1089
1024
  */
1090
1025
  declare function isTemplateStringsArray(input: unknown): input is TemplateStringsArray;
1091
1026
  //#endregion
1092
- //#region src/functions/taggedTemplate/normaliseIndents.d.ts
1027
+ //#region src/root/functions/taggedTemplate/normaliseIndents.d.ts
1093
1028
  /**
1094
1029
  * Options to apply to the normalisation of indents in multi-line template strings
1095
1030
  *
@@ -1157,75 +1092,4 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1157
1092
  */
1158
1093
  declare const normalizeIndents: typeof normaliseIndents;
1159
1094
  //#endregion
1160
- //#region src/functions/versioning/determineVersionType.d.ts
1161
- /**
1162
- * Determines whether the given version is a major, minor, or patch version.
1163
- *
1164
- * @deprecated This function does not support the new class-based handling of VersionNumber. Please use `new VersionNumber(version).type` instead.
1165
- *
1166
- * @param version - The version number.
1167
- *
1168
- * @returns Either `"major"`, `"minor"`, or `"patch"`, depending on the version type.
1169
- */
1170
- declare function determineVersionType(version: string): VersionType;
1171
- //#endregion
1172
- //#region src/functions/versioning/getIndividualVersionNumbers.d.ts
1173
- /**
1174
- * Gets the individual version numbers from a given version number as a tuple of numbers.
1175
- *
1176
- * @deprecated This function does not support the new class-based handling of VersionNumber. Please use one of the following instead:
1177
- * ```typescript
1178
- * new VersionNumber(version).major
1179
- * new VersionNumber(version).minor
1180
- * new VersionNumber(version).patch
1181
- * ```
1182
- *
1183
- * @param version - The version number.
1184
- *
1185
- * @returns A tuple of three numbers indicating `[major, minor, patch]`.
1186
- */
1187
- declare function getIndividualVersionNumbers(version: string): [number, number, number];
1188
- //#endregion
1189
- //#region src/functions/versioning/incrementVersion.d.ts
1190
- interface IncrementVersionOptions {
1191
- /** Whether to omit the `v` prefix from the output version or not. */
1192
- omitPrefix?: boolean;
1193
- }
1194
- /**
1195
- * Increments the given input version depending on the given increment type.
1196
- *
1197
- * @deprecated This function does not support the new class-based handling of VersionNumber. Please use `new VersionNumber(version).increment(incrementType)` instead.
1198
- *
1199
- * @param version - The version to increment
1200
- * @param incrementType - The type of increment. Can be one of the following:
1201
- * - `"major"`: Change the major version `v1.2.3` → `v2.0.0`
1202
- * - `"minor"`: Change the minor version `v1.2.3` → `v1.3.0`
1203
- * - `"patch"`: Change the patch version `v1.2.3` → `v1.2.4`
1204
- * @param options - Extra options to apply.
1205
- *
1206
- * @returns A new string representing the version with the increment applied.
1207
- */
1208
- declare function incrementVersion(version: string, incrementType: VersionType, options?: IncrementVersionOptions): string;
1209
- //#endregion
1210
- //#region src/functions/versioning/parseVersion.d.ts
1211
- interface ParseVersionOptions {
1212
- /** Whether to omit the `v` prefix from the output version or not. */
1213
- omitPrefix?: boolean;
1214
- }
1215
- /**
1216
- * Parses a string and verifies it is a valid package version number.
1217
- *
1218
- * Valid formats: `X.Y.Z` or `vX.Y.Z`, where X, Y, and Z are non-negative integers.
1219
- *
1220
- * @deprecated This function does not support the new class-based handling of VersionNumber. Please use `new VersionNumber(input)` instead.
1221
- *
1222
- * @param input - The version string to parse.
1223
- * @param options - Extra options to apply.
1224
- *
1225
- * @throws {DataError} If the input is not a valid version number.
1226
- *
1227
- * @returns The validated version number, prefixed with `v` if it was not already.
1228
- */
1229
- declare function parseVersion(input: string, options?: ParseVersionOptions): string;
1230
- //#endregion
1231
- export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IncrementVersionOptions, type IsTypeArgumentString, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type OptionalOnCondition, ParallelTuple, type ParseVersionOptions, type PublicAndPrivateKey, type RecordKey, type RemoveUndefined, type StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, type VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1095
+ export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type OptionalOnCondition, ParallelTuple, type RecordKey, type RemoveUndefined, type StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getDependenciesFromGroup, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };