@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.js CHANGED
@@ -18,6 +18,8 @@ var VERSION_NUMBER_REGEX_default = VERSION_NUMBER_REGEX;
18
18
  * If the callback returns at least one Promise, the entire result will be wrapped
19
19
  * in a `Promise` and resolved with `Promise.all`. Otherwise, a plain array is returned.
20
20
  *
21
+ * @category Array Helpers
22
+ *
21
23
  * @template ItemType
22
24
  *
23
25
  * @param callback - A function invoked with the current index. May return a value or a Promise.
@@ -44,6 +46,8 @@ var fillArray_default = fillArray;
44
46
  * If `secondArray` is shorter than `firstArray`, the second position in the tuple
45
47
  * will be `undefined`. Iteration always uses the length of the first array.
46
48
  *
49
+ * @category Array Helpers
50
+ *
47
51
  * @template FirstArrayItem
48
52
  * @template SecondArrayItem
49
53
  *
@@ -69,7 +73,11 @@ const httpErrorCodeLookup = {
69
73
  418: "I_AM_A_TEAPOT",
70
74
  500: "INTERNAL_SERVER_ERROR"
71
75
  };
72
- /** Represents common errors you may get from a HTTP API request. */
76
+ /**
77
+ * Represents common errors you may get from a HTTP API request.
78
+ *
79
+ * @category Types
80
+ */
73
81
  var APIError = class extends Error {
74
82
  status;
75
83
  /**
@@ -101,10 +109,14 @@ var APIError_default = APIError;
101
109
 
102
110
  //#endregion
103
111
  //#region src/types/DataError.ts
104
- /** Represents errors you may get that may've been caused by a specific piece of data. */
112
+ /**
113
+ * Represents errors you may get that may've been caused by a specific piece of data.
114
+ *
115
+ * @category Types
116
+ */
105
117
  var DataError = class extends Error {
106
- data;
107
118
  code;
119
+ data;
108
120
  /**
109
121
  * @param data - The data that caused the error.
110
122
  * @param code - A standardised code (e.g. UNEXPECTED_DATA).
@@ -134,25 +146,21 @@ var DataError = class extends Error {
134
146
  };
135
147
  var DataError_default = DataError;
136
148
 
137
- //#endregion
138
- //#region src/types/VersionType.ts
139
- const VersionType = {
140
- MAJOR: "major",
141
- MINOR: "minor",
142
- PATCH: "patch"
143
- };
144
-
145
149
  //#endregion
146
150
  //#region src/types/VersionNumber.ts
147
- /** Represents a software version number, considered to be made up of a major, minor, and patch part. */
151
+ /**
152
+ * Represents a software version number, considered to be made up of a major, minor, and patch part.
153
+ *
154
+ * @category Types
155
+ */
148
156
  var VersionNumber = class VersionNumber {
157
+ static NON_NEGATIVE_TUPLE_ERROR = "Input array must be a tuple of three non-negative integers.";
149
158
  /** The major number. Increments when a feature is removed or changed in a way that is not backwards-compatible with the previous release. */
150
159
  major = 0;
151
160
  /** The minor number. Increments when a new feature is added/deprecated and is expected to be backwards-compatible with the previous release. */
152
161
  minor = 0;
153
162
  /** The patch number. Increments when the next release is fixing a bug or doing a small refactor that should not be noticeable in practice. */
154
163
  patch = 0;
155
- static NON_NEGATIVE_TUPLE_ERROR = "Input array must be a tuple of three non-negative integers.";
156
164
  /**
157
165
  * @param input - The input to create a new instance of `VersionNumber` from.
158
166
  */
@@ -181,21 +189,6 @@ var VersionNumber = class VersionNumber {
181
189
  this.patch = patch;
182
190
  }
183
191
  }
184
- static formatString(input, options) {
185
- if (options?.omitPrefix) return input.startsWith("v") ? input.slice(1) : input;
186
- return input.startsWith("v") ? input : `v${input}`;
187
- }
188
- /**
189
- * Get a string representation of the current version number.
190
- *
191
- * @param options - Extra additional options to apply.
192
- *
193
- * @returns A stringified representation of the current version number, leaving out the prefix if `omitPrefix` option was set to true.
194
- */
195
- toString(options) {
196
- const rawString = `${this.major}.${this.minor}.${this.patch}`;
197
- return VersionNumber.formatString(rawString, options);
198
- }
199
192
  /**
200
193
  * Gets the current version type of the current instance of `VersionNumber`.
201
194
  *
@@ -206,6 +199,21 @@ var VersionNumber = class VersionNumber {
206
199
  if (this.patch === 0) return VersionType.MINOR;
207
200
  return VersionType.PATCH;
208
201
  }
202
+ static formatString(input, options) {
203
+ if (options?.omitPrefix) return input.startsWith("v") ? input.slice(1) : input;
204
+ return input.startsWith("v") ? input : `v${input}`;
205
+ }
206
+ /**
207
+ * Checks if the provided version numbers have the exact same major, minor, and patch numbers.
208
+ *
209
+ * @param firstVersion - The first version number to compare.
210
+ * @param secondVersion - The second version number to compare.
211
+ *
212
+ * @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
213
+ */
214
+ static isEqual(firstVersion, secondVersion) {
215
+ return firstVersion.major === secondVersion.major && firstVersion.minor === secondVersion.minor && firstVersion.patch === secondVersion.patch;
216
+ }
209
217
  /**
210
218
  * Determines whether the current instance of `VersionNumber` is a major, minor, or patch version.
211
219
  *
@@ -217,35 +225,34 @@ var VersionNumber = class VersionNumber {
217
225
  * @returns A new instance of `VersionNumber` with the increment applied.
218
226
  */
219
227
  increment(incrementType) {
220
- const newVersion = {
221
- major: [
228
+ return {
229
+ major: new VersionNumber([
222
230
  this.major + 1,
223
231
  0,
224
232
  0
225
- ],
226
- minor: [
233
+ ]),
234
+ minor: new VersionNumber([
227
235
  this.major,
228
236
  this.minor + 1,
229
237
  0
230
- ],
231
- patch: [
238
+ ]),
239
+ patch: new VersionNumber([
232
240
  this.major,
233
241
  this.minor,
234
242
  this.patch + 1
235
- ]
243
+ ])
236
244
  }[incrementType];
237
- return new VersionNumber(newVersion);
238
245
  }
239
246
  /**
240
- * Checks if the provided version numbers have the exact same major, minor, and patch numbers.
247
+ * Get a string representation of the current version number.
241
248
  *
242
- * @param firstVersion - The first version number to compare.
243
- * @param secondVersion - The second version number to compare.
249
+ * @param options - Extra additional options to apply.
244
250
  *
245
- * @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
251
+ * @returns A stringified representation of the current version number, leaving out the prefix if `omitPrefix` option was set to true.
246
252
  */
247
- static isEqual(firstVersion, secondVersion) {
248
- return firstVersion.major === secondVersion.major && firstVersion.minor === secondVersion.minor && firstVersion.patch === secondVersion.patch;
253
+ toString(options) {
254
+ const rawString = `${this.major}.${this.minor}.${this.patch}`;
255
+ return VersionNumber.formatString(rawString, options);
249
256
  }
250
257
  };
251
258
  var VersionNumber_default = VersionNumber;
@@ -255,6 +262,8 @@ var VersionNumber_default = VersionNumber;
255
262
  /**
256
263
  * Converts a string to an integer and throws an error if it cannot be converted.
257
264
  *
265
+ * @category Parsers
266
+ *
258
267
  * @param string - A string to convert into a number.
259
268
  * @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.
260
269
  *
@@ -286,6 +295,8 @@ var parseIntStrict_default = parseIntStrict;
286
295
  /**
287
296
  * Gets a random number between the given bounds.
288
297
  *
298
+ * @category Miscellaneous
299
+ *
289
300
  * @param lowerBound - The lowest number that can be chosen.
290
301
  * @param upperBound - The highest number that can be chosen.
291
302
  *
@@ -303,6 +314,8 @@ var getRandomNumber_default = getRandomNumber;
303
314
  /**
304
315
  * Randomises the order of a given array and returns the result in a new array without mutating the original.
305
316
  *
317
+ * @category Array Helpers
318
+ *
306
319
  * @template ItemType - The type of the array items.
307
320
  *
308
321
  * @param array - The array to randomise.
@@ -328,6 +341,8 @@ var randomiseArray_default = randomiseArray;
328
341
  * - The range is inclusive of `start` and exclusive of `stop`.
329
342
  * - The sign of `step` must match the direction of the range.
330
343
  *
344
+ * @category Array Helpers
345
+ *
331
346
  * @param start - The number to start at (inclusive).
332
347
  * @param stop - The number to stop at (exclusive).
333
348
  * @param step - The step size between numbers, defaulting to 1.
@@ -356,6 +371,8 @@ var range_default = range;
356
371
  /**
357
372
  * Removes duplicate values from an array.
358
373
  *
374
+ * @category Array Helpers
375
+ *
359
376
  * @template ItemType - The type of the array items.
360
377
  *
361
378
  * @param array - The array to remove duplicates from.
@@ -374,6 +391,8 @@ var removeDuplicates_default = removeDuplicates;
374
391
  /**
375
392
  * Adds a given number of days to the provided date, returning the result as a new instance of Date.
376
393
  *
394
+ * @category Date
395
+ *
377
396
  * @param currentDate - The starting date (defaults to today).
378
397
  * @param dayIncrement - The amount of days you want to add (defaults to 1)
379
398
  *
@@ -391,6 +410,8 @@ var addDaysToDate_default = addDaysToDate;
391
410
  /**
392
411
  * Checks if the provided dates happen on the exact same day, month, and year.
393
412
  *
413
+ * @category Date
414
+ *
394
415
  * @param firstDate - The first date to compare.
395
416
  * @param secondDate - The second date to compare.
396
417
  *
@@ -406,6 +427,8 @@ var isSameDate_default = isSameDate;
406
427
  /**
407
428
  * Creates a human-readable string with information about the input date.
408
429
  *
430
+ * @category Date
431
+ *
409
432
  * @param inputDate - The date to base the string on.
410
433
  *
411
434
  * @returns A new string with information about the given date.
@@ -429,6 +452,8 @@ var formatDateAndTime_default = formatDateAndTime;
429
452
  /**
430
453
  * Checks if the provided year is a leap year.
431
454
  *
455
+ * @category Date
456
+ *
432
457
  * @param year - The year to check as a number.
433
458
  *
434
459
  * @throws {TypeError} If the year provided is not an integer.
@@ -450,6 +475,8 @@ function checkLeapYear(firstDate, secondDate) {
450
475
  /**
451
476
  * Checks if the provided dates are exactly a whole number of years apart.
452
477
  *
478
+ * @category Date
479
+ *
453
480
  * @param firstDate - The first date to compare.
454
481
  * @param secondDate - The second date to compare.
455
482
  *
@@ -496,6 +523,8 @@ function leapYearFebruaryChecks(firstDate, secondDate) {
496
523
  /**
497
524
  * Checks if the provided dates are exactly a whole number of months apart.
498
525
  *
526
+ * @category Date
527
+ *
499
528
  * @param firstDate - The first date to compare.
500
529
  * @param secondDate - The second date to compare.
501
530
  *
@@ -514,6 +543,8 @@ var isMonthlyMultiple_default = isMonthlyMultiple;
514
543
  /**
515
544
  * Asynchronously converts a file to a base 64 string
516
545
  *
546
+ * @category Miscellaneous
547
+ *
517
548
  * @param file - The file to convert.
518
549
  *
519
550
  * @throws {Error} If the file reader gives an error.
@@ -546,6 +577,8 @@ function getNullableResolutionStrategy(key, strategy) {
546
577
  /**
547
578
  * Creates FormData from a given object, resolving non-string types as appropriate.
548
579
  *
580
+ * @category Miscellaneous
581
+ *
549
582
  * @template DataType - The type of the given data.
550
583
  *
551
584
  * @param data - The data to create FormData from.
@@ -611,6 +644,8 @@ var createFormData_default = createFormData;
611
644
  /**
612
645
  * Checks to see if the given array is sorted in ascending order.
613
646
  *
647
+ * @category Miscellaneous
648
+ *
614
649
  * @param array - The array to check.
615
650
  *
616
651
  * @returns `true` if the array is sorted in ascending order, and `false` otherwise.
@@ -628,6 +663,8 @@ var isOrdered_default = isOrdered;
628
663
  /**
629
664
  * Converts a stringly-typed list to a proper array.
630
665
  *
666
+ * @category Miscellaneous
667
+ *
631
668
  * @param stringList - The stringly-typed list to convert.
632
669
  * @param options - The options to apply to the conversion.
633
670
  * @param options.separator - What each item in the list is separated by.
@@ -649,6 +686,8 @@ var stringListToArray_default = stringListToArray;
649
686
  /**
650
687
  * Waits for the given number of seconds
651
688
  *
689
+ * @category Miscellaneous
690
+ *
652
691
  * @param seconds - The number of seconds to wait.
653
692
  *
654
693
  * @returns A Promise that resolves after the given number of seconds.
@@ -667,6 +706,8 @@ var wait_default = wait;
667
706
  /**
668
707
  * Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
669
708
  *
709
+ * @category Object Helpers
710
+ *
670
711
  * @template InputRecordType - The type of the input object.
671
712
  *
672
713
  * @param record - The record to get the keys from.
@@ -683,6 +724,8 @@ var getRecordKeys_default = getRecordKeys;
683
724
  /**
684
725
  * Omits properties from a given object.
685
726
  *
727
+ * @category Object Helpers
728
+ *
686
729
  * @template ObjectType - The type of the input object.
687
730
  * @template KeysToOmit - A type representing the keys to omit from the object.
688
731
  *
@@ -705,6 +748,8 @@ var omitProperties_default = omitProperties;
705
748
  /**
706
749
  * Takes a stringly-typed boolean and converts it to an actual boolean type.
707
750
  *
751
+ * @category Parsers
752
+ *
708
753
  * @param inputString - The string to parse.
709
754
  *
710
755
  * @throws {DataError} If the string is not either `true` or `false` (case insensitive).
@@ -723,6 +768,8 @@ var parseBoolean_default = parseBoolean;
723
768
  /**
724
769
  * An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
725
770
  *
771
+ * @category Parsers
772
+ *
726
773
  * @template Output - The Zod output type.
727
774
  * @template Input - The Zod input type.
728
775
  * @template Internals - The Zod internal types based on the output and input types.
@@ -745,14 +792,21 @@ var parseZodSchema_default = parseZodSchema;
745
792
 
746
793
  //#endregion
747
794
  //#region src/functions/parsers/parseEnv.ts
748
- const envSchema = z$1.enum([
749
- "test",
750
- "development",
751
- "production"
752
- ]);
795
+ /**
796
+ * Represents the three common development environments.
797
+ *
798
+ * @category Types
799
+ */
800
+ const Env = {
801
+ TEST: "test",
802
+ DEVELOPMENT: "development",
803
+ PRODUCTION: "production"
804
+ };
753
805
  /**
754
806
  * Parses the input and verifies it matches one of the environments allowed by the Env types ("test" | "development" | "production").
755
807
  *
808
+ * @category Parsers
809
+ *
756
810
  * @param data - The data to parse.
757
811
  *
758
812
  * @throws {DataError} If the data does not match one of the environments allowed by the Env types ("test" | "development" | "production").
@@ -760,7 +814,7 @@ const envSchema = z$1.enum([
760
814
  * @returns The specified environment if allowed.
761
815
  */
762
816
  function parseEnv(data) {
763
- return parseZodSchema_default(envSchema, data, new DataError_default(data, "INVALID_ENV", "The provided environment type must be one of `test | development | production`"));
817
+ return parseZodSchema_default(z$1.enum(Env), data, new DataError_default(data, "INVALID_ENV", "The provided environment type must be one of `test | development | production`"));
764
818
  }
765
819
  var parseEnv_default = parseEnv;
766
820
 
@@ -769,6 +823,8 @@ var parseEnv_default = parseEnv;
769
823
  /**
770
824
  * Returns an object given FormData and an optional data parser function to call on the resulting object.
771
825
  *
826
+ * @category Parsers
827
+ *
772
828
  * @template DataType - The type of the resulting object when called from the dataParser.
773
829
  *
774
830
  * @param formData - The FormData to parse.
@@ -789,8 +845,20 @@ var parseFormData_default = parseFormData;
789
845
  //#endregion
790
846
  //#region src/functions/parsers/parseVersionType.ts
791
847
  /**
848
+ * Represents the three common software version types.
849
+ *
850
+ * @category Types
851
+ */
852
+ const VersionType = {
853
+ MAJOR: "major",
854
+ MINOR: "minor",
855
+ PATCH: "patch"
856
+ };
857
+ /**
792
858
  * Parses the input and verifies it is a valid software version type (i.e. `"major" | "minor" | "patch"`)
793
859
  *
860
+ * @category Parsers
861
+ *
794
862
  * @param data - The data to parse.
795
863
  *
796
864
  * @throws {DataError} If the data does not match one of the allowed version types (`"major" | "minor" | "patch"`).
@@ -810,6 +878,8 @@ function callDeepCopy(input) {
810
878
  /**
811
879
  * Deeply copies an object or array such that all child objects/arrays are also copied.
812
880
  *
881
+ * @category Recursive
882
+ *
813
883
  * @template ObjectType - The type of the input object.
814
884
  *
815
885
  * @param object - The object to copy. May also be an array.
@@ -837,6 +907,8 @@ var deepCopy_default = deepCopy;
837
907
  * Note that this will also freeze the input itself as well.
838
908
  * 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.
839
909
  *
910
+ * @category Recursive
911
+ *
840
912
  * @template ObjectType - The type of the input object.
841
913
  *
842
914
  * @param object - The object to freeze. May also be an array.
@@ -857,6 +929,8 @@ var deepFreeze_default = deepFreeze;
857
929
  /**
858
930
  * Appends a semicolon to the end of a string, trimming where necessary first.
859
931
  *
932
+ * @category String Helpers
933
+ *
860
934
  * @param stringToAppendTo - The string to append a semicolon to.
861
935
  *
862
936
  * @throws {Error} If the string contains multiple lines.
@@ -876,6 +950,8 @@ var appendSemicolon_default = appendSemicolon;
876
950
  /**
877
951
  * Converts a string from camelCase to kebab-case
878
952
  *
953
+ * @category String Helpers
954
+ *
879
955
  * @param string - The string to convert.
880
956
  * @param options - Options to apply to the conversion.
881
957
  *
@@ -914,6 +990,8 @@ var camelToKebab_default = camelToKebab;
914
990
  /**
915
991
  * Converts a string from kebab-case to camelCase
916
992
  *
993
+ * @category String Helpers
994
+ *
917
995
  * @param string - The string to convert.
918
996
  * @param options - Options to apply to the conversion.
919
997
  *
@@ -951,13 +1029,14 @@ var kebabToCamel_default = kebabToCamel;
951
1029
  //#region src/functions/stringHelpers/normalizeImportPath.ts
952
1030
  /**
953
1031
  * Normalizes an import path meant for use in an import statement in JavaScript.
954
- *
955
1032
  * 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.
956
1033
  *
957
1034
  * If the path starts with ./, it is preserved (unlike what would happen with path.posix.normalize() normally).
958
1035
  *
959
1036
  * Helpful for custom linter rules that need to check (or fix) import paths.
960
1037
  *
1038
+ * @category String Helpers
1039
+ *
961
1040
  * @param importPath - The import path to normalize.
962
1041
  *
963
1042
  * @returns The import path normalized.
@@ -969,13 +1048,14 @@ function normalizeImportPath(importPath) {
969
1048
  }
970
1049
  /**
971
1050
  * Normalises an import path meant for use in an import statement in JavaScript.
972
- *
973
1051
  * 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.
974
1052
  *
975
1053
  * If the path starts with ./, it is preserved (unlike what would happen with path.posix.normalize() normally).
976
1054
  *
977
1055
  * Helpful for custom linter rules that need to check (or fix) import paths.
978
1056
  *
1057
+ * @category String Helpers
1058
+ *
979
1059
  * @param importPath - The import path to normalise.
980
1060
  *
981
1061
  * @returns The import path normalised.
@@ -988,6 +1068,8 @@ var normalizeImportPath_default = normalizeImportPath;
988
1068
  /**
989
1069
  * Truncates a string and appends `...` to the end of it
990
1070
  *
1071
+ * @category String Helpers
1072
+ *
991
1073
  * @param stringToTruncate - The string to truncate.
992
1074
  * @param maxLength - The length at which to start truncating. Note that this does not include the `...` part that would be appended.
993
1075
  *
@@ -1003,6 +1085,8 @@ var truncate_default = truncate;
1003
1085
  /**
1004
1086
  * Creates a template strings array given a regular array of strings
1005
1087
  *
1088
+ * @category Tagged Template
1089
+ *
1006
1090
  * @param strings - The array of strings.
1007
1091
  *
1008
1092
  * @returns A template strings array that can be passed as the first argument of any tagged template function.
@@ -1019,10 +1103,14 @@ var createTemplateStringsArray_default = createTemplateStringsArray;
1019
1103
  *
1020
1104
  * You can pass a template string directly by doing:
1021
1105
  *
1022
- * interpolate`Template string here`.
1106
+ * ```
1107
+ * interpolate`Template string here`.
1108
+ * ```
1023
1109
  *
1024
1110
  * In this case, it will be functionally the same as if you just wrote the template string by itself.
1025
1111
  *
1112
+ * @category Tagged Template
1113
+ *
1026
1114
  * @param strings - The strings from the template to process.
1027
1115
  * @param interpolations - An array of all interpolations from the template.
1028
1116
  *
@@ -1042,7 +1130,11 @@ var interpolate_default = interpolate;
1042
1130
  *
1043
1131
  * You can pass a template string directly by doing:
1044
1132
  *
1045
- * interpolateObjects`Template string here ${{ my: "object" }}`.
1133
+ * ```typescript
1134
+ * interpolateObjects`Template string here ${{ my: "object" }}`.
1135
+ * ```
1136
+ *
1137
+ * @category Tagged Template
1046
1138
  *
1047
1139
  * @param strings - The strings from the template to process.
1048
1140
  * @param interpolations - An array of all interpolations from the template.
@@ -1090,15 +1182,21 @@ function reduceLines(lines, { preserveTabs = true }) {
1090
1182
  *
1091
1183
  * You can pass a template string directly by doing:
1092
1184
  *
1093
- * normaliseIndents`Template string here
1094
- * with a new line
1095
- * and another new line`.
1185
+ * ```typescript
1186
+ * normaliseIndents`Template string here
1187
+ * with a new line
1188
+ * and another new line`.
1189
+ * ```
1096
1190
  *
1097
1191
  * You may also pass the options first, then invoke the resulting function with a template string:
1098
1192
  *
1099
- * normaliseIndents({ preserveTabs: false })`Template string here
1100
- * with a new line
1101
- * and another new line`.
1193
+ * ```typescript
1194
+ * normaliseIndents({ preserveTabs: false })`Template string here
1195
+ * with a new line
1196
+ * and another new line`.
1197
+ * ```
1198
+ *
1199
+ *@category Tagged Template
1102
1200
  *
1103
1201
  * @param first - The strings from the template to process, or the options to apply.
1104
1202
  * @param args - An array of all interpolations from the template.
@@ -1121,15 +1219,19 @@ function normaliseIndents(first, ...args) {
1121
1219
  *
1122
1220
  * You can pass a template string directly by doing:
1123
1221
  *
1124
- * normalizeIndents`Template string here
1125
- * with a new line
1126
- * and another new line`.
1222
+ * ```typescript
1223
+ * normalizeIndents`Template string here
1224
+ * with a new line
1225
+ * and another new line`.
1226
+ * ```
1127
1227
  *
1128
1228
  * You may also pass the options first, then invoke the resulting function with a template string:
1129
1229
  *
1130
- * normalizeIndents({ preserveTabs: false })`Template string here
1131
- * with a new line
1132
- * and another new line`.
1230
+ * ```typescript
1231
+ * normalizeIndents({ preserveTabs: false })`Template string here
1232
+ * with a new line
1233
+ * and another new line`.
1234
+ * ```
1133
1235
  *
1134
1236
  * @param first - The strings from the template to process, or the options to apply.
1135
1237
  * @param args - An array of all interpolations from the template.
@@ -1232,4 +1334,4 @@ function incrementVersion(version, incrementType, options) {
1232
1334
  var incrementVersion_default = incrementVersion;
1233
1335
 
1234
1336
  //#endregion
1235
- export { APIError_default as APIError, DataError_default as DataError, NAMESPACE_EXPORT_REGEX_default as NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX_default as VERSION_NUMBER_REGEX, VersionNumber_default as VersionNumber, VersionType, addDaysToDate_default as addDaysToDate, appendSemicolon_default as appendSemicolon, camelToKebab_default as camelToKebab, convertFileToBase64_default as convertFileToBase64, createFormData_default as createFormData, createTemplateStringsArray_default as createTemplateStringsArray, deepCopy_default as deepCopy, deepFreeze_default as deepFreeze, determineVersionType_default as determineVersionType, fillArray_default as fillArray, formatDateAndTime_default as formatDateAndTime, getIndividualVersionNumbers_default as getIndividualVersionNumbers, getRandomNumber_default as getRandomNumber, getRecordKeys_default as getRecordKeys, httpErrorCodeLookup, incrementVersion_default as incrementVersion, interpolate_default as interpolate, interpolateObjects_default as interpolateObjects, isAnniversary_default as isAnniversary, isLeapYear_default as isLeapYear, isMonthlyMultiple_default as isMonthlyMultiple, isOrdered_default as isOrdered, isSameDate_default as isSameDate, kebabToCamel_default as kebabToCamel, normaliseImportPath, normaliseIndents_default as normaliseIndents, normalizeImportPath_default as normalizeImportPath, normalizeIndents, omitProperties_default as omitProperties, paralleliseArrays_default as paralleliseArrays, parseBoolean_default as parseBoolean, parseEnv_default as parseEnv, parseFormData_default as parseFormData, parseIntStrict_default as parseIntStrict, parseVersion_default as parseVersion, parseVersionType_default as parseVersionType, parseZodSchema_default as parseZodSchema, randomiseArray_default as randomiseArray, range_default as range, removeDuplicates_default as removeDuplicates, stringListToArray_default as stringListToArray, truncate_default as truncate, wait_default as wait };
1337
+ export { APIError_default as APIError, DataError_default as DataError, Env, NAMESPACE_EXPORT_REGEX_default as NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX_default as VERSION_NUMBER_REGEX, VersionNumber_default as VersionNumber, VersionType, addDaysToDate_default as addDaysToDate, appendSemicolon_default as appendSemicolon, camelToKebab_default as camelToKebab, convertFileToBase64_default as convertFileToBase64, createFormData_default as createFormData, createTemplateStringsArray_default as createTemplateStringsArray, deepCopy_default as deepCopy, deepFreeze_default as deepFreeze, determineVersionType_default as determineVersionType, fillArray_default as fillArray, formatDateAndTime_default as formatDateAndTime, getIndividualVersionNumbers_default as getIndividualVersionNumbers, getRandomNumber_default as getRandomNumber, getRecordKeys_default as getRecordKeys, httpErrorCodeLookup, incrementVersion_default as incrementVersion, interpolate_default as interpolate, interpolateObjects_default as interpolateObjects, isAnniversary_default as isAnniversary, isLeapYear_default as isLeapYear, isMonthlyMultiple_default as isMonthlyMultiple, isOrdered_default as isOrdered, isSameDate_default as isSameDate, kebabToCamel_default as kebabToCamel, normaliseImportPath, normaliseIndents_default as normaliseIndents, normalizeImportPath_default as normalizeImportPath, normalizeIndents, omitProperties_default as omitProperties, paralleliseArrays_default as paralleliseArrays, parseBoolean_default as parseBoolean, parseEnv_default as parseEnv, parseFormData_default as parseFormData, parseIntStrict_default as parseIntStrict, parseVersion_default as parseVersion, parseVersionType_default as parseVersionType, parseZodSchema_default as parseZodSchema, randomiseArray_default as randomiseArray, range_default as range, removeDuplicates_default as removeDuplicates, stringListToArray_default as stringListToArray, truncate_default as truncate, wait_default as wait };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "4.3.0",
3
+ "version": "4.3.2",
4
4
  "description": "Helpful utility functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "zod": "^4.2.1"
20
20
  },
21
21
  "devDependencies": {
22
- "@alextheman/eslint-plugin": "^5.1.0",
22
+ "@alextheman/eslint-plugin": "^5.2.1",
23
23
  "@types/node": "^25.0.3",
24
24
  "alex-c-line": "^1.10.0",
25
25
  "dotenv-cli": "^11.0.0",
@@ -29,6 +29,7 @@
29
29
  "jsdom": "^27.3.0",
30
30
  "prettier": "^3.7.4",
31
31
  "tsdown": "^0.18.1",
32
+ "typedoc": "^0.28.15",
32
33
  "typescript": "^5.9.3",
33
34
  "vite-tsconfig-paths": "^6.0.3",
34
35
  "vitest": "^4.0.16"
@@ -38,6 +39,7 @@
38
39
  },
39
40
  "scripts": {
40
41
  "build": "tsdown",
42
+ "create-feature-docs": "typedoc",
41
43
  "create-local-package": "pnpm run build && rm -f alextheman-utility-*.tgz && pnpm pack",
42
44
  "create-release-note-major": "git pull origin main && alex-c-line create-release-note major",
43
45
  "create-release-note-minor": "git pull origin main && alex-c-line create-release-note minor",
@@ -45,12 +47,12 @@
45
47
  "format": "pnpm run format-prettier && pnpm run format-eslint",
46
48
  "format-eslint": "eslint --fix --suppress-all \"package.json\" \"src/**/*.ts\" \"tests/**/*.ts\" && rm -f eslint-suppressions.json",
47
49
  "format-prettier": "pnpm run format-prettier-typescript && pnpm run format-prettier-javascript",
48
- "format-prettier-javascript": "prettier --write \"./**/*.js\"",
50
+ "format-prettier-javascript": "prettier --write \"./**/*.js\" \"!docs\"",
49
51
  "format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
50
52
  "lint": "pnpm run lint-tsc && pnpm run lint-eslint && pnpm run lint-prettier",
51
53
  "lint-eslint": "eslint \"package.json\" \"src/**/*.ts\" \"tests/**/*.ts\"",
52
54
  "lint-prettier": "pnpm run lint-prettier-typescript && pnpm run lint-prettier-javascript",
53
- "lint-prettier-javascript": "prettier --check \"./**/*.js\"",
55
+ "lint-prettier-javascript": "prettier --check \"./**/*.js\" \"!docs\"",
54
56
  "lint-prettier-typescript": "prettier --check --parser typescript \"./**/*.ts\"",
55
57
  "lint-tsc": "tsc --noEmit",
56
58
  "prepare-live-eslint-plugin": "pnpm uninstall @alextheman/eslint-plugin && pnpm install --save-dev @alextheman/eslint-plugin",