@alextheman/utility 4.3.0 → 4.3.2

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,4 +1,4 @@
1
- import { ZodType, core, z } from "zod";
1
+ import { ZodType, core } from "zod";
2
2
 
3
3
  //#region src/constants/NAMESPACE_EXPORT_REGEX.d.ts
4
4
  declare const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
@@ -44,6 +44,8 @@ type ParallelTuple<A, B> = [A, B | undefined];
44
44
  * If `secondArray` is shorter than `firstArray`, the second position in the tuple
45
45
  * will be `undefined`. Iteration always uses the length of the first array.
46
46
  *
47
+ * @category Array Helpers
48
+ *
47
49
  * @template FirstArrayItem
48
50
  * @template SecondArrayItem
49
51
  *
@@ -58,6 +60,8 @@ declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray:
58
60
  /**
59
61
  * Randomises the order of a given array and returns the result in a new array without mutating the original.
60
62
  *
63
+ * @category Array Helpers
64
+ *
61
65
  * @template ItemType - The type of the array items.
62
66
  *
63
67
  * @param array - The array to randomise.
@@ -73,6 +77,8 @@ declare function randomiseArray<ItemType>(array: ItemType[]): ItemType[];
73
77
  * - The range is inclusive of `start` and exclusive of `stop`.
74
78
  * - The sign of `step` must match the direction of the range.
75
79
  *
80
+ * @category Array Helpers
81
+ *
76
82
  * @param start - The number to start at (inclusive).
77
83
  * @param stop - The number to stop at (exclusive).
78
84
  * @param step - The step size between numbers, defaulting to 1.
@@ -88,6 +94,8 @@ declare function range(start: number, stop: number, step?: number): number[];
88
94
  /**
89
95
  * Removes duplicate values from an array.
90
96
  *
97
+ * @category Array Helpers
98
+ *
91
99
  * @template ItemType - The type of the array items.
92
100
  *
93
101
  * @param array - The array to remove duplicates from.
@@ -100,6 +108,8 @@ declare function removeDuplicates<ItemType>(array: ItemType[] | readonly ItemTyp
100
108
  /**
101
109
  * Adds a given number of days to the provided date, returning the result as a new instance of Date.
102
110
  *
111
+ * @category Date
112
+ *
103
113
  * @param currentDate - The starting date (defaults to today).
104
114
  * @param dayIncrement - The amount of days you want to add (defaults to 1)
105
115
  *
@@ -111,6 +121,8 @@ declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
111
121
  /**
112
122
  * Creates a human-readable string with information about the input date.
113
123
  *
124
+ * @category Date
125
+ *
114
126
  * @param inputDate - The date to base the string on.
115
127
  *
116
128
  * @returns A new string with information about the given date.
@@ -125,6 +137,8 @@ declare function formatDateAndTime(inputDate: Date): string;
125
137
  /**
126
138
  * Checks if the provided dates are exactly a whole number of years apart.
127
139
  *
140
+ * @category Date
141
+ *
128
142
  * @param firstDate - The first date to compare.
129
143
  * @param secondDate - The second date to compare.
130
144
  *
@@ -136,6 +150,8 @@ declare function isAnniversary(firstDate: Date, secondDate: Date): boolean;
136
150
  /**
137
151
  * Checks if the provided year is a leap year.
138
152
  *
153
+ * @category Date
154
+ *
139
155
  * @param year - The year to check as a number.
140
156
  *
141
157
  * @throws {TypeError} If the year provided is not an integer.
@@ -148,6 +164,8 @@ declare function isLeapYear(year: number): boolean;
148
164
  /**
149
165
  * Checks if the provided dates are exactly a whole number of months apart.
150
166
  *
167
+ * @category Date
168
+ *
151
169
  * @param firstDate - The first date to compare.
152
170
  * @param secondDate - The second date to compare.
153
171
  *
@@ -159,6 +177,8 @@ declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
159
177
  /**
160
178
  * Checks if the provided dates happen on the exact same day, month, and year.
161
179
  *
180
+ * @category Date
181
+ *
162
182
  * @param firstDate - The first date to compare.
163
183
  * @param secondDate - The second date to compare.
164
184
  *
@@ -170,6 +190,8 @@ declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
170
190
  /**
171
191
  * Asynchronously converts a file to a base 64 string
172
192
  *
193
+ * @category Miscellaneous
194
+ *
173
195
  * @param file - The file to convert.
174
196
  *
175
197
  * @throws {Error} If the file reader gives an error.
@@ -181,7 +203,11 @@ declare function convertFileToBase64(file: File): Promise<string>;
181
203
  //#region src/types/APIError.d.ts
182
204
  type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
183
205
  declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
184
- /** Represents common errors you may get from a HTTP API request. */
206
+ /**
207
+ * Represents common errors you may get from a HTTP API request.
208
+ *
209
+ * @category Types
210
+ */
185
211
  declare class APIError extends Error {
186
212
  status: number;
187
213
  /**
@@ -201,10 +227,14 @@ declare class APIError extends Error {
201
227
  }
202
228
  //#endregion
203
229
  //#region src/types/DataError.d.ts
204
- /** Represents errors you may get that may've been caused by a specific piece of data. */
230
+ /**
231
+ * Represents errors you may get that may've been caused by a specific piece of data.
232
+ *
233
+ * @category Types
234
+ */
205
235
  declare class DataError extends Error {
206
- data: unknown;
207
236
  code: string;
237
+ data: unknown;
208
238
  /**
209
239
  * @param data - The data that caused the error.
210
240
  * @param code - A standardised code (e.g. UNEXPECTED_DATA).
@@ -222,58 +252,49 @@ declare class DataError extends Error {
222
252
  static check(input: unknown): input is DataError;
223
253
  }
224
254
  //#endregion
225
- //#region src/types/RecordKey.d.ts
226
- /** Represents the native Record's possible key type. */
227
- type RecordKey = string | number | symbol;
228
- //#endregion
229
- //#region src/types/CreateEnumType.d.ts
255
+ //#region src/types/VersionNumber.d.ts
230
256
  /**
231
- * Get the value types from a const object so the object can behave similarly to an enum.
257
+ * Options to apply to the stringification of the version number.
232
258
  *
233
- * @template ObjectType - The type of the object to get the value types for.
259
+ * @category Class Options
234
260
  */
235
- type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
236
- //#endregion
237
- //#region src/types/VersionType.d.ts
238
- declare const VersionType: {
239
- readonly MAJOR: "major";
240
- readonly MINOR: "minor";
241
- readonly PATCH: "patch";
242
- };
243
- type VersionType = CreateEnumType<typeof VersionType>;
244
- //#endregion
245
- //#region src/types/VersionNumber.d.ts
246
- interface ToStringOptions {
261
+ interface VersionNumberToStringOptions {
262
+ /** Whether you want to omit the "v" prefix or not (defaults to false). */
247
263
  omitPrefix?: boolean;
248
264
  }
249
- /** Represents a software version number, considered to be made up of a major, minor, and patch part. */
265
+ /**
266
+ * Represents a software version number, considered to be made up of a major, minor, and patch part.
267
+ *
268
+ * @category Types
269
+ */
250
270
  declare class VersionNumber {
271
+ private static readonly NON_NEGATIVE_TUPLE_ERROR;
251
272
  /** The major number. Increments when a feature is removed or changed in a way that is not backwards-compatible with the previous release. */
252
273
  readonly major: number;
253
274
  /** The minor number. Increments when a new feature is added/deprecated and is expected to be backwards-compatible with the previous release. */
254
275
  readonly minor: number;
255
276
  /** The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice. */
256
277
  readonly patch: number;
257
- private static readonly NON_NEGATIVE_TUPLE_ERROR;
258
278
  /**
259
279
  * @param input - The input to create a new instance of `VersionNumber` from.
260
280
  */
261
281
  constructor(input: string | [number, number, number] | VersionNumber);
262
- private static formatString;
263
- /**
264
- * Get a string representation of the current version number.
265
- *
266
- * @param options - Extra additional options to apply.
267
- *
268
- * @returns A stringified representation of the current version number, leaving out the prefix if `omitPrefix` option was set to true.
269
- */
270
- toString(options?: ToStringOptions): string;
271
282
  /**
272
283
  * Gets the current version type of the current instance of `VersionNumber`.
273
284
  *
274
285
  * @returns Either `"major"`, `"minor"`, or `"patch"`, depending on the version type.
275
286
  */
276
287
  get type(): VersionType;
288
+ private static formatString;
289
+ /**
290
+ * Checks if the provided version numbers have the exact same major, minor, and patch numbers.
291
+ *
292
+ * @param firstVersion - The first version number to compare.
293
+ * @param secondVersion - The second version number to compare.
294
+ *
295
+ * @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
296
+ */
297
+ static isEqual(firstVersion: VersionNumber, secondVersion: VersionNumber): boolean;
277
298
  /**
278
299
  * Determines whether the current instance of `VersionNumber` is a major, minor, or patch version.
279
300
  *
@@ -286,28 +307,49 @@ declare class VersionNumber {
286
307
  */
287
308
  increment(incrementType: VersionType): VersionNumber;
288
309
  /**
289
- * Checks if the provided version numbers have the exact same major, minor, and patch numbers.
310
+ * Get a string representation of the current version number.
290
311
  *
291
- * @param firstVersion - The first version number to compare.
292
- * @param secondVersion - The second version number to compare.
312
+ * @param options - Extra additional options to apply.
293
313
  *
294
- * @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
314
+ * @returns A stringified representation of the current version number, leaving out the prefix if `omitPrefix` option was set to true.
295
315
  */
296
- static isEqual(firstVersion: VersionNumber, secondVersion: VersionNumber): boolean;
316
+ toString(options?: VersionNumberToStringOptions): string;
297
317
  }
298
318
  //#endregion
299
319
  //#region src/types/ArrayElement.d.ts
300
320
  /**
301
321
  * Gets the individual element types from an array type.
302
322
  *
323
+ * @category Types
324
+ *
303
325
  * @template ArrayType - The type of the array itself.
304
326
  */
305
327
  type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
306
328
  //#endregion
329
+ //#region src/types/RecordKey.d.ts
330
+ /**
331
+ * Represents the native Record's possible key type.
332
+ *
333
+ * @category Types
334
+ */
335
+ type RecordKey = string | number | symbol;
336
+ //#endregion
337
+ //#region src/types/CreateEnumType.d.ts
338
+ /**
339
+ * Get the value types from a const object so the object can behave similarly to an enum.
340
+ *
341
+ * @category Types
342
+ *
343
+ * @template ObjectType - The type of the object to get the value types for.
344
+ */
345
+ type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
346
+ //#endregion
307
347
  //#region src/types/DisallowUndefined.d.ts
308
348
  /**
309
349
  * Resolves to an error message type if the type argument could potentially be undefined.
310
350
  *
351
+ * @category Types
352
+ *
311
353
  * @template InputType - The type to disallow undefined on.
312
354
  */
313
355
  type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Generic type cannot include undefined"] : InputType;
@@ -316,6 +358,8 @@ type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Gener
316
358
  /**
317
359
  * Allows case-insensitive variants of a known string type.
318
360
  *
361
+ * @category Types
362
+ *
319
363
  * @template StringType - The input string type.
320
364
  */
321
365
  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>}` : "";
@@ -324,6 +368,8 @@ type IgnoreCase<StringType extends string> = string extends StringType ? string
324
368
  /**
325
369
  * Resolves to `never` if the given type may be undefined.
326
370
  *
371
+ * @category Types
372
+ *
327
373
  * @template InputType - The type to check.
328
374
  */
329
375
  type NonUndefined<InputType> = InputType extends undefined ? never : InputType;
@@ -332,6 +378,8 @@ type NonUndefined<InputType> = InputType extends undefined ? never : InputType;
332
378
  /**
333
379
  * Resolves to the given type if the first type is `true`, otherwise resolves to `undefined`
334
380
  *
381
+ * @category Types
382
+ *
335
383
  * @param Condition - The condition to check.
336
384
  * @param ResolvedTypeIfTrue - The type to resolve to if the condition may be `true`.
337
385
  */
@@ -340,10 +388,24 @@ type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condit
340
388
  //#region src/functions/miscellaneous/createFormData.d.ts
341
389
  type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
342
390
  type FormDataArrayResolutionStrategy = "stringify" | "multiple";
391
+ /**
392
+ * Base options for resolving form data.
393
+ *
394
+ * @category Function Options
395
+ *
396
+ * @template Key - The type of the key of the input record.
397
+ */
343
398
  interface CreateFormDataOptionsBase<Key extends RecordKey> {
344
399
  /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
345
400
  arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
346
401
  }
402
+ /**
403
+ * Options for resolving form data when it may be undefined or null, but not both.
404
+ *
405
+ * @category Function Options
406
+ *
407
+ * @template Key - The type of the key of the input record.
408
+ */
347
409
  interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
348
410
  /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
349
411
  undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
@@ -352,6 +414,13 @@ interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends RecordKey>
352
414
  /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
353
415
  nullableResolution?: never;
354
416
  }
417
+ /**
418
+ * Options for resolving form data when it may be nullable, but not both.
419
+ *
420
+ * @category Function Options
421
+ *
422
+ * @template Key - The type of the key of the input record.
423
+ */
355
424
  interface CreateFormDataOptionsNullableResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
356
425
  /** @note This must not be provided at the same time as nullableResolution. */
357
426
  undefinedResolution?: never;
@@ -360,10 +429,19 @@ interface CreateFormDataOptionsNullableResolution<Key extends RecordKey> extends
360
429
  /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
361
430
  nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
362
431
  }
432
+ /**
433
+ * Options for resolving form data.
434
+ *
435
+ * @category Function Options
436
+ *
437
+ * @template Key - The type of the key of the input record.
438
+ */
363
439
  type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
364
440
  /**
365
441
  * Creates FormData from a given object, resolving non-string types as appropriate.
366
442
  *
443
+ * @category Miscellaneous
444
+ *
367
445
  * @template DataType - The type of the given data.
368
446
  *
369
447
  * @param data - The data to create FormData from.
@@ -377,6 +455,8 @@ declare function createFormData<DataType extends Record<RecordKey, unknown>>(dat
377
455
  /**
378
456
  * Gets a random number between the given bounds.
379
457
  *
458
+ * @category Miscellaneous
459
+ *
380
460
  * @param lowerBound - The lowest number that can be chosen.
381
461
  * @param upperBound - The highest number that can be chosen.
382
462
  *
@@ -388,6 +468,8 @@ declare function getRandomNumber(lowerBound: number, upperBound: number): number
388
468
  /**
389
469
  * Checks to see if the given array is sorted in ascending order.
390
470
  *
471
+ * @category Miscellaneous
472
+ *
391
473
  * @param array - The array to check.
392
474
  *
393
475
  * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
@@ -395,6 +477,11 @@ declare function getRandomNumber(lowerBound: number, upperBound: number): number
395
477
  declare function isOrdered(array: readonly number[]): boolean;
396
478
  //#endregion
397
479
  //#region src/functions/miscellaneous/stringListToArray.d.ts
480
+ /**
481
+ * Options to apply to the conversion of a string list to an array.
482
+ *
483
+ * @category Function Options
484
+ */
398
485
  interface StringListToArrayOptions {
399
486
  /** What each item in the list is separated by. */
400
487
  separator?: string;
@@ -404,6 +491,8 @@ interface StringListToArrayOptions {
404
491
  /**
405
492
  * Converts a stringly-typed list to a proper array.
406
493
  *
494
+ * @category Miscellaneous
495
+ *
407
496
  * @param stringList - The stringly-typed list to convert.
408
497
  * @param options - The options to apply to the conversion.
409
498
  * @param options.separator - What each item in the list is separated by.
@@ -420,6 +509,8 @@ declare function stringListToArray(stringList: string, {
420
509
  /**
421
510
  * Waits for the given number of seconds
422
511
  *
512
+ * @category Miscellaneous
513
+ *
423
514
  * @param seconds - The number of seconds to wait.
424
515
  *
425
516
  * @returns A Promise that resolves after the given number of seconds.
@@ -430,6 +521,8 @@ declare function wait(seconds: number): Promise<void>;
430
521
  /**
431
522
  * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
432
523
  *
524
+ * @category Object Helpers
525
+ *
433
526
  * @template InputRecordType - The type of the input object.
434
527
  *
435
528
  * @param record - The record to get the keys from.
@@ -442,6 +535,8 @@ declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown
442
535
  /**
443
536
  * Omits properties from a given object.
444
537
  *
538
+ * @category Object Helpers
539
+ *
445
540
  * @template ObjectType - The type of the input object.
446
541
  * @template KeysToOmit - A type representing the keys to omit from the object.
447
542
  *
@@ -456,6 +551,8 @@ declare function omitProperties<ObjectType extends Record<string, unknown> | Rea
456
551
  /**
457
552
  * Takes a stringly-typed boolean and converts it to an actual boolean type.
458
553
  *
554
+ * @category Parsers
555
+ *
459
556
  * @param inputString - The string to parse.
460
557
  *
461
558
  * @throws {DataError} If the string is not either `true` or `false` (case insensitive).
@@ -465,16 +562,22 @@ declare function omitProperties<ObjectType extends Record<string, unknown> | Rea
465
562
  declare function parseBoolean(inputString: string): boolean;
466
563
  //#endregion
467
564
  //#region src/functions/parsers/parseEnv.d.ts
468
- declare const envSchema: z.ZodEnum<{
469
- test: "test";
470
- development: "development";
471
- production: "production";
472
- }>;
473
- /** Represents the most common development environments */
474
- type Env = z.infer<typeof envSchema>;
565
+ /**
566
+ * Represents the three common development environments.
567
+ *
568
+ * @category Types
569
+ */
570
+ declare const Env: {
571
+ TEST: string;
572
+ DEVELOPMENT: string;
573
+ PRODUCTION: string;
574
+ };
575
+ type Env = CreateEnumType<typeof Env>;
475
576
  /**
476
577
  * Parses the input and verifies it matches one of the environments allowed by the Env types ("test" | "development" | "production").
477
578
  *
579
+ * @category Parsers
580
+ *
478
581
  * @param data - The data to parse.
479
582
  *
480
583
  * @throws {DataError} If the data does not match one of the environments allowed by the Env types ("test" | "development" | "production").
@@ -508,6 +611,8 @@ declare function parseFormData(formData: FormData): Record<string, string | Blob
508
611
  /**
509
612
  * Converts a string to an integer and throws an error if it cannot be converted.
510
613
  *
614
+ * @category Parsers
615
+ *
511
616
  * @param string - A string to convert into a number.
512
617
  * @param radix - A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.
513
618
  *
@@ -518,9 +623,22 @@ declare function parseFormData(formData: FormData): Record<string, string | Blob
518
623
  declare function parseIntStrict(string: string, radix?: number): number;
519
624
  //#endregion
520
625
  //#region src/functions/parsers/parseVersionType.d.ts
626
+ /**
627
+ * Represents the three common software version types.
628
+ *
629
+ * @category Types
630
+ */
631
+ declare const VersionType: {
632
+ readonly MAJOR: "major";
633
+ readonly MINOR: "minor";
634
+ readonly PATCH: "patch";
635
+ };
636
+ type VersionType = CreateEnumType<typeof VersionType>;
521
637
  /**
522
638
  * Parses the input and verifies it is a valid software version type (i.e. `"major" | "minor" | "patch"`)
523
639
  *
640
+ * @category Parsers
641
+ *
524
642
  * @param data - The data to parse.
525
643
  *
526
644
  * @throws {DataError} If the data does not match one of the allowed version types (`"major" | "minor" | "patch"`).
@@ -533,6 +651,8 @@ declare function parseVersionType(data: unknown): VersionType;
533
651
  /**
534
652
  * An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
535
653
  *
654
+ * @category Parsers
655
+ *
536
656
  * @template Output - The Zod output type.
537
657
  * @template Input - The Zod input type.
538
658
  * @template Internals - The Zod internal types based on the output and input types.
@@ -552,6 +672,8 @@ declare function parseZodSchema<Output, Input, Internals extends core.$ZodTypeIn
552
672
  /**
553
673
  * Deeply copies an object or array such that all child objects/arrays are also copied.
554
674
  *
675
+ * @category Recursive
676
+ *
555
677
  * @template ObjectType - The type of the input object.
556
678
  *
557
679
  * @param object - The object to copy. May also be an array.
@@ -567,6 +689,8 @@ declare function deepCopy<ObjectType extends object>(object: ObjectType): Object
567
689
  * Note that this will also freeze the input itself as well.
568
690
  * If the intent is to create a newly frozen object with a different reference in memory, pass your object through deepCopy first before passing to deepFreeze.
569
691
  *
692
+ * @category Recursive
693
+ *
570
694
  * @template ObjectType - The type of the input object.
571
695
  *
572
696
  * @param object - The object to freeze. May also be an array.
@@ -579,6 +703,8 @@ declare function deepFreeze<ObjectType extends object>(object: ObjectType): Read
579
703
  /**
580
704
  * Appends a semicolon to the end of a string, trimming where necessary first.
581
705
  *
706
+ * @category String Helpers
707
+ *
582
708
  * @param stringToAppendTo - The string to append a semicolon to.
583
709
  *
584
710
  * @throws {Error} If the string contains multiple lines.
@@ -588,6 +714,11 @@ declare function deepFreeze<ObjectType extends object>(object: ObjectType): Read
588
714
  declare function appendSemicolon(stringToAppendTo: string): string;
589
715
  //#endregion
590
716
  //#region src/functions/stringHelpers/camelToKebab.d.ts
717
+ /**
718
+ * Options to apply to the conversion from camelCase to kebab-case
719
+ *
720
+ * @category Function Options
721
+ */
591
722
  interface CamelToKebabOptions {
592
723
  /** Whether to leave consecutive capitals alone in the conversion or not (e.g. `validateAPIUser` becomes `validate-a-p-i-user` if `false`, and `validate-api-user` if `true`) */
593
724
  preserveConsecutiveCapitals?: boolean;
@@ -595,6 +726,8 @@ interface CamelToKebabOptions {
595
726
  /**
596
727
  * Converts a string from camelCase to kebab-case
597
728
  *
729
+ * @category String Helpers
730
+ *
598
731
  * @param string - The string to convert.
599
732
  * @param options - Options to apply to the conversion.
600
733
  *
@@ -603,6 +736,11 @@ interface CamelToKebabOptions {
603
736
  declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
604
737
  //#endregion
605
738
  //#region src/functions/stringHelpers/kebabToCamel.d.ts
739
+ /**
740
+ * Options to apply to the conversion from kebab-case to camelCase
741
+ *
742
+ * @category Function Options
743
+ */
606
744
  interface KebabToCamelOptions {
607
745
  /** Whether or not the converted string should start with an uppercase (e.g. CamelCase instead of camelCase). */
608
746
  startWithUpper?: boolean;
@@ -610,6 +748,8 @@ interface KebabToCamelOptions {
610
748
  /**
611
749
  * Converts a string from kebab-case to camelCase
612
750
  *
751
+ * @category String Helpers
752
+ *
613
753
  * @param string - The string to convert.
614
754
  * @param options - Options to apply to the conversion.
615
755
  *
@@ -620,13 +760,14 @@ declare function kebabToCamel(string: string, options?: KebabToCamelOptions): st
620
760
  //#region src/functions/stringHelpers/normalizeImportPath.d.ts
621
761
  /**
622
762
  * Normalizes an import path meant for use in an import statement in JavaScript.
623
- *
624
763
  * 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.
625
764
  *
626
765
  * If the path starts with ./, it is preserved (unlike what would happen with path.posix.normalize() normally).
627
766
  *
628
767
  * Helpful for custom linter rules that need to check (or fix) import paths.
629
768
  *
769
+ * @category String Helpers
770
+ *
630
771
  * @param importPath - The import path to normalize.
631
772
  *
632
773
  * @returns The import path normalized.
@@ -634,13 +775,14 @@ declare function kebabToCamel(string: string, options?: KebabToCamelOptions): st
634
775
  declare function normalizeImportPath(importPath: string): string;
635
776
  /**
636
777
  * Normalises an import path meant for use in an import statement in JavaScript.
637
- *
638
778
  * 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.
639
779
  *
640
780
  * If the path starts with ./, it is preserved (unlike what would happen with path.posix.normalize() normally).
641
781
  *
642
782
  * Helpful for custom linter rules that need to check (or fix) import paths.
643
783
  *
784
+ * @category String Helpers
785
+ *
644
786
  * @param importPath - The import path to normalise.
645
787
  *
646
788
  * @returns The import path normalised.
@@ -651,6 +793,8 @@ declare const normaliseImportPath: typeof normalizeImportPath;
651
793
  /**
652
794
  * Truncates a string and appends `...` to the end of it
653
795
  *
796
+ * @category String Helpers
797
+ *
654
798
  * @param stringToTruncate - The string to truncate.
655
799
  * @param maxLength - The length at which to start truncating. Note that this does not include the `...` part that would be appended.
656
800
  *
@@ -662,6 +806,8 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
662
806
  /**
663
807
  * Creates a template strings array given a regular array of strings
664
808
  *
809
+ * @category Tagged Template
810
+ *
665
811
  * @param strings - The array of strings.
666
812
  *
667
813
  * @returns A template strings array that can be passed as the first argument of any tagged template function.
@@ -674,10 +820,14 @@ declare function createTemplateStringsArray(strings: readonly string[]): Templat
674
820
  *
675
821
  * You can pass a template string directly by doing:
676
822
  *
677
- * interpolate`Template string here`.
823
+ * ```
824
+ * interpolate`Template string here`.
825
+ * ```
678
826
  *
679
827
  * In this case, it will be functionally the same as if you just wrote the template string by itself.
680
828
  *
829
+ * @category Tagged Template
830
+ *
681
831
  * @param strings - The strings from the template to process.
682
832
  * @param interpolations - An array of all interpolations from the template.
683
833
  *
@@ -691,7 +841,11 @@ declare function interpolate(strings: TemplateStringsArray, ...interpolations: u
691
841
  *
692
842
  * You can pass a template string directly by doing:
693
843
  *
694
- * interpolateObjects`Template string here ${{ my: "object" }}`.
844
+ * ```typescript
845
+ * interpolateObjects`Template string here ${{ my: "object" }}`.
846
+ * ```
847
+ *
848
+ * @category Tagged Template
695
849
  *
696
850
  * @param strings - The strings from the template to process.
697
851
  * @param interpolations - An array of all interpolations from the template.
@@ -701,6 +855,11 @@ declare function interpolate(strings: TemplateStringsArray, ...interpolations: u
701
855
  declare function interpolateObjects(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
702
856
  //#endregion
703
857
  //#region src/functions/taggedTemplate/normaliseIndents.d.ts
858
+ /**
859
+ * Options to apply to the normalisation of indents in multi-line template strings
860
+ *
861
+ * @category Function Options
862
+ */
704
863
  interface NormaliseIndentsOptions {
705
864
  /** Whether to preserve extra tabs or not (defaults to true) */
706
865
  preserveTabs?: boolean;
@@ -711,6 +870,8 @@ type NormalizeIndentsFunction = NormaliseIndentsFunction;
711
870
  /**
712
871
  * Provides a new function that removes any extraneous indents from a multi-line template string, with the given options applied.
713
872
  *
873
+ * @category Tagged Template
874
+ *
714
875
  * @param options - The options to apply.
715
876
  *
716
877
  * @returns A function that takes a template string, and returns a new string with the strings and interpolations from the template applied, and extraneous indents removed.
@@ -721,9 +882,13 @@ declare function normaliseIndents(options: NormaliseIndentsOptions): NormaliseIn
721
882
  *
722
883
  * You can pass a template string directly by doing:
723
884
  *
724
- * normaliseIndents`Template string here
725
- * with a new line
726
- * and another new line`.
885
+ * ```typescript
886
+ * normaliseIndents`Template string here
887
+ * with a new line
888
+ * and another new line`.
889
+ * ```
890
+ *
891
+ *@category Tagged Template
727
892
  *
728
893
  * @param strings - The strings from the template to process.
729
894
  * @param interpolations - An array of all interpolations from the template.
@@ -736,15 +901,19 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
736
901
  *
737
902
  * You can pass a template string directly by doing:
738
903
  *
739
- * normalizeIndents`Template string here
740
- * with a new line
741
- * and another new line`.
904
+ * ```typescript
905
+ * normalizeIndents`Template string here
906
+ * with a new line
907
+ * and another new line`.
908
+ * ```
742
909
  *
743
910
  * You may also pass the options first, then invoke the resulting function with a template string:
744
911
  *
745
- * normalizeIndents({ preserveTabs: false })`Template string here
746
- * with a new line
747
- * and another new line`.
912
+ * ```typescript
913
+ * normalizeIndents({ preserveTabs: false })`Template string here
914
+ * with a new line
915
+ * and another new line`.
916
+ * ```
748
917
  *
749
918
  * @param first - The strings from the template to process, or the options to apply.
750
919
  * @param args - An array of all interpolations from the template.
@@ -824,4 +993,4 @@ interface ParseVersionOptions {
824
993
  */
825
994
  declare function parseVersion(input: string, options?: ParseVersionOptions): string;
826
995
  //#endregion
827
- export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParseVersionOptions, RecordKey, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, fillArray, formatDateAndTime, getIndividualVersionNumbers, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, randomiseArray, range, removeDuplicates, stringListToArray, truncate, wait };
996
+ export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, RecordKey, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, fillArray, formatDateAndTime, getIndividualVersionNumbers, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, randomiseArray, range, removeDuplicates, stringListToArray, truncate, wait };