@alextheman/utility 4.17.0 → 5.0.1
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.cjs +111 -258
- package/dist/index.d.cts +124 -258
- package/dist/index.d.ts +124 -258
- package/dist/index.js +111 -251
- package/dist/internal/index.cjs +700 -0
- package/dist/internal/index.d.cts +107 -0
- package/dist/internal/index.d.ts +108 -0
- package/dist/internal/index.js +661 -0
- package/dist/node/index.cjs +594 -0
- package/dist/node/index.d.cts +46 -0
- package/dist/node/index.d.ts +48 -0
- package/dist/node/index.js +562 -0
- package/package.json +13 -3
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,27 @@ 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/
|
|
193
|
+
//#region src/internal/DependencyGroup.d.ts
|
|
194
|
+
declare const DependencyGroup: {
|
|
195
|
+
readonly DEPENDENCIES: "dependencies";
|
|
196
|
+
readonly DEV_DEPENDENCIES: "devDependencies";
|
|
197
|
+
};
|
|
198
|
+
type DependencyGroup = CreateEnumType<typeof DependencyGroup>;
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/internal/getDependenciesFromGroup.d.ts
|
|
201
|
+
/**
|
|
202
|
+
* Get the dependencies from a given dependency group in `package.json`.
|
|
203
|
+
*
|
|
204
|
+
* @category Miscellaneous
|
|
205
|
+
*
|
|
206
|
+
* @param packageInfo - The data coming from `package.json`.
|
|
207
|
+
* @param dependencyGroup - The group to get dependency information about (can be `dependencies` or `devDependencies`).
|
|
208
|
+
*
|
|
209
|
+
* @returns A record consisting of the package names and version ranges from the given dependency group.
|
|
210
|
+
*/
|
|
211
|
+
declare function getDependenciesFromGroup(packageInfo: Record<string, unknown>, dependencyGroup: DependencyGroup): Record<string, string>;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/root/functions/miscellaneous/convertFileToBase64.d.ts
|
|
195
214
|
/**
|
|
196
215
|
* Asynchronously converts a file to a base 64 string
|
|
197
216
|
*
|
|
@@ -205,7 +224,7 @@ declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
|
205
224
|
*/
|
|
206
225
|
declare function convertFileToBase64(file: File): Promise<string>;
|
|
207
226
|
//#endregion
|
|
208
|
-
//#region src/types/APIError.d.ts
|
|
227
|
+
//#region src/root/types/APIError.d.ts
|
|
209
228
|
type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
|
|
210
229
|
declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
|
|
211
230
|
/**
|
|
@@ -231,22 +250,32 @@ declare class APIError extends Error {
|
|
|
231
250
|
static check(input: unknown): input is APIError;
|
|
232
251
|
}
|
|
233
252
|
//#endregion
|
|
234
|
-
//#region src/types/
|
|
253
|
+
//#region src/root/types/RecordKey.d.ts
|
|
254
|
+
/**
|
|
255
|
+
* Represents the native Record's possible key type.
|
|
256
|
+
*
|
|
257
|
+
* @category Types
|
|
258
|
+
*/
|
|
259
|
+
type RecordKey = string | number | symbol;
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/root/types/DataError.d.ts
|
|
235
262
|
/**
|
|
236
263
|
* Represents errors you may get that may've been caused by a specific piece of data.
|
|
237
264
|
*
|
|
238
265
|
* @category Types
|
|
266
|
+
*
|
|
267
|
+
* @template DataType - The type of the data that caused the error.
|
|
239
268
|
*/
|
|
240
|
-
declare class DataError extends Error {
|
|
269
|
+
declare class DataError<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>> extends Error {
|
|
241
270
|
code: string;
|
|
242
|
-
data:
|
|
271
|
+
data: DataType;
|
|
243
272
|
/**
|
|
244
273
|
* @param data - The data that caused the error.
|
|
245
274
|
* @param code - A standardised code (e.g. UNEXPECTED_DATA).
|
|
246
275
|
* @param message - A human-readable error message (e.g. The data provided is invalid).
|
|
247
276
|
* @param options - Extra options to pass to super Error constructor.
|
|
248
277
|
*/
|
|
249
|
-
constructor(data:
|
|
278
|
+
constructor(data: DataType, code?: string, message?: string, options?: ErrorOptions);
|
|
250
279
|
/**
|
|
251
280
|
* Checks whether the given input may have been caused by a DataError.
|
|
252
281
|
*
|
|
@@ -254,19 +283,32 @@ declare class DataError extends Error {
|
|
|
254
283
|
*
|
|
255
284
|
* @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
285
|
*/
|
|
257
|
-
static check(input: unknown): input is DataError
|
|
286
|
+
static check<DataType extends Record<RecordKey, unknown> = Record<RecordKey, unknown>>(input: unknown): input is DataError<DataType>;
|
|
258
287
|
}
|
|
259
288
|
//#endregion
|
|
260
|
-
//#region src/types/VersionNumber.d.ts
|
|
289
|
+
//#region src/root/types/VersionNumber.d.ts
|
|
261
290
|
/**
|
|
262
291
|
* Options to apply to the stringification of the version number.
|
|
263
292
|
*
|
|
264
293
|
* @category Class Options
|
|
265
294
|
*/
|
|
266
|
-
interface
|
|
295
|
+
interface FormatOptionsBase {
|
|
267
296
|
/** Whether you want to omit the "v" prefix or not (defaults to false). */
|
|
268
297
|
omitPrefix?: boolean;
|
|
269
298
|
}
|
|
299
|
+
interface FormatOptionsIncludeMinor extends FormatOptionsBase {
|
|
300
|
+
/** Whether you want to omit the minor version or not */
|
|
301
|
+
omitMinor?: false;
|
|
302
|
+
/** Whether you want to omit the patch version or not */
|
|
303
|
+
omitPatch?: boolean;
|
|
304
|
+
}
|
|
305
|
+
interface FormatOptionsOmitMinor extends FormatOptionsBase {
|
|
306
|
+
/** Whether you want to omit the minor version or not */
|
|
307
|
+
omitMinor?: true;
|
|
308
|
+
/** Whether you want to omit the patch version or not */
|
|
309
|
+
omitPatch?: never;
|
|
310
|
+
}
|
|
311
|
+
type FormatStringOptions = FormatOptionsIncludeMinor | FormatOptionsOmitMinor;
|
|
270
312
|
/**
|
|
271
313
|
* Represents a software version number, considered to be made up of a major, minor, and patch part.
|
|
272
314
|
*
|
|
@@ -300,6 +342,14 @@ declare class VersionNumber {
|
|
|
300
342
|
* @returns `true` if the provided version numbers have exactly the same major, minor, and patch numbers, and returns `false` otherwise.
|
|
301
343
|
*/
|
|
302
344
|
static isEqual(firstVersion: VersionNumber, secondVersion: VersionNumber): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Get a formatted string representation of the current version number
|
|
347
|
+
*
|
|
348
|
+
* @param options - Options to apply to the string formatting.
|
|
349
|
+
*
|
|
350
|
+
* @returns A formatted string representation of the current version number with the options applied.
|
|
351
|
+
*/
|
|
352
|
+
format(options?: FormatStringOptions): string;
|
|
303
353
|
/**
|
|
304
354
|
* Increments the current version number by the given increment type, returning the result as a new reference in memory.
|
|
305
355
|
*
|
|
@@ -329,15 +379,13 @@ declare class VersionNumber {
|
|
|
329
379
|
/**
|
|
330
380
|
* Get a string representation of the current version number.
|
|
331
381
|
*
|
|
332
|
-
* @
|
|
333
|
-
*
|
|
334
|
-
* @returns A stringified representation of the current version number, leaving out the prefix if `omitPrefix` option was set to true.
|
|
382
|
+
* @returns A stringified representation of the current version number with the prefix.
|
|
335
383
|
*/
|
|
336
|
-
toString(
|
|
384
|
+
toString(): string;
|
|
337
385
|
}
|
|
338
386
|
declare const zodVersionNumber: z.ZodType<VersionNumber>;
|
|
339
387
|
//#endregion
|
|
340
|
-
//#region src/types/ArrayElement.d.ts
|
|
388
|
+
//#region src/root/types/ArrayElement.d.ts
|
|
341
389
|
/**
|
|
342
390
|
* Gets the individual element types from an array type.
|
|
343
391
|
*
|
|
@@ -347,18 +395,10 @@ declare const zodVersionNumber: z.ZodType<VersionNumber>;
|
|
|
347
395
|
*/
|
|
348
396
|
type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
|
|
349
397
|
//#endregion
|
|
350
|
-
//#region src/types/CallReturnType.d.ts
|
|
398
|
+
//#region src/root/types/CallReturnType.d.ts
|
|
351
399
|
type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) => infer Return) ? Return : never;
|
|
352
400
|
//#endregion
|
|
353
|
-
//#region src/types/
|
|
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
|
|
401
|
+
//#region src/root/types/CreateEnumType.d.ts
|
|
362
402
|
/**
|
|
363
403
|
* Get the value types from a const object so the object can behave similarly to an enum.
|
|
364
404
|
*
|
|
@@ -368,7 +408,7 @@ type RecordKey = string | number | symbol;
|
|
|
368
408
|
*/
|
|
369
409
|
type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[keyof ObjectType];
|
|
370
410
|
//#endregion
|
|
371
|
-
//#region src/types/DisallowUndefined.d.ts
|
|
411
|
+
//#region src/root/types/DisallowUndefined.d.ts
|
|
372
412
|
/**
|
|
373
413
|
* Resolves to an error message type if the type argument could potentially be undefined.
|
|
374
414
|
*
|
|
@@ -378,7 +418,7 @@ type CreateEnumType<ObjectType extends Record<RecordKey, unknown>> = ObjectType[
|
|
|
378
418
|
*/
|
|
379
419
|
type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Generic type cannot include undefined"] : InputType;
|
|
380
420
|
//#endregion
|
|
381
|
-
//#region src/types/IgnoreCase.d.ts
|
|
421
|
+
//#region src/root/types/IgnoreCase.d.ts
|
|
382
422
|
/**
|
|
383
423
|
* Allows case-insensitive variants of a known string type.
|
|
384
424
|
*
|
|
@@ -388,10 +428,10 @@ type DisallowUndefined<InputType> = undefined extends InputType ? ["Error: Gener
|
|
|
388
428
|
*/
|
|
389
429
|
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
430
|
//#endregion
|
|
391
|
-
//#region src/types/IsTypeArgumentString.d.ts
|
|
431
|
+
//#region src/root/types/IsTypeArgumentString.d.ts
|
|
392
432
|
type IsTypeArgumentString<Argument extends string> = Argument;
|
|
393
433
|
//#endregion
|
|
394
|
-
//#region src/types/NonUndefined.d.ts
|
|
434
|
+
//#region src/root/types/NonUndefined.d.ts
|
|
395
435
|
/**
|
|
396
436
|
* Resolves to `never` if the given type may be undefined.
|
|
397
437
|
*
|
|
@@ -401,7 +441,7 @@ type IsTypeArgumentString<Argument extends string> = Argument;
|
|
|
401
441
|
*/
|
|
402
442
|
type NonUndefined<InputType> = InputType extends undefined ? never : InputType;
|
|
403
443
|
//#endregion
|
|
404
|
-
//#region src/types/OptionalOnCondition.d.ts
|
|
444
|
+
//#region src/root/types/OptionalOnCondition.d.ts
|
|
405
445
|
/**
|
|
406
446
|
* Resolves to the given type if the first type is `true`, otherwise resolves to `undefined`
|
|
407
447
|
*
|
|
@@ -412,7 +452,7 @@ type NonUndefined<InputType> = InputType extends undefined ? never : InputType;
|
|
|
412
452
|
*/
|
|
413
453
|
type OptionalOnCondition<Condition extends boolean, ResolvedTypeIfTrue> = Condition extends true ? ResolvedTypeIfTrue : ResolvedTypeIfTrue | undefined;
|
|
414
454
|
//#endregion
|
|
415
|
-
//#region src/functions/miscellaneous/createFormData.d.ts
|
|
455
|
+
//#region src/root/functions/miscellaneous/createFormData.d.ts
|
|
416
456
|
type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
|
|
417
457
|
type FormDataArrayResolutionStrategy = "stringify" | "multiple";
|
|
418
458
|
/**
|
|
@@ -478,7 +518,7 @@ type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefin
|
|
|
478
518
|
*/
|
|
479
519
|
declare function createFormData<DataType extends Record<RecordKey, unknown>>(data: DataType, options?: CreateFormDataOptions<keyof DataType>): FormData;
|
|
480
520
|
//#endregion
|
|
481
|
-
//#region src/functions/miscellaneous/getRandomNumber.d.ts
|
|
521
|
+
//#region src/root/functions/miscellaneous/getRandomNumber.d.ts
|
|
482
522
|
/**
|
|
483
523
|
* Gets a random number between the given bounds.
|
|
484
524
|
*
|
|
@@ -491,7 +531,7 @@ declare function createFormData<DataType extends Record<RecordKey, unknown>>(dat
|
|
|
491
531
|
*/
|
|
492
532
|
declare function getRandomNumber(lowerBound: number, upperBound: number): number;
|
|
493
533
|
//#endregion
|
|
494
|
-
//#region src/functions/miscellaneous/isOrdered.d.ts
|
|
534
|
+
//#region src/root/functions/miscellaneous/isOrdered.d.ts
|
|
495
535
|
/**
|
|
496
536
|
* Checks to see if the given array is sorted in ascending order.
|
|
497
537
|
*
|
|
@@ -503,7 +543,7 @@ declare function getRandomNumber(lowerBound: number, upperBound: number): number
|
|
|
503
543
|
*/
|
|
504
544
|
declare function isOrdered(array: readonly number[]): boolean;
|
|
505
545
|
//#endregion
|
|
506
|
-
//#region src/functions/miscellaneous/sayHello.d.ts
|
|
546
|
+
//#region src/root/functions/miscellaneous/sayHello.d.ts
|
|
507
547
|
/**
|
|
508
548
|
* Returns a string representing the lyrics to the package's theme song, Commit To You
|
|
509
549
|
*
|
|
@@ -513,7 +553,7 @@ declare function isOrdered(array: readonly number[]): boolean;
|
|
|
513
553
|
*/
|
|
514
554
|
declare function sayHello(): string;
|
|
515
555
|
//#endregion
|
|
516
|
-
//#region src/functions/miscellaneous/stringifyDotenv.d.ts
|
|
556
|
+
//#region src/root/functions/miscellaneous/stringifyDotenv.d.ts
|
|
517
557
|
type QuoteStyle = "double" | "single" | "none";
|
|
518
558
|
interface StringifyDotenvOptions {
|
|
519
559
|
/** The quote style to use for the values (defaults to `"double"`) */
|
|
@@ -529,7 +569,7 @@ interface StringifyDotenvOptions {
|
|
|
529
569
|
*/
|
|
530
570
|
declare function stringifyDotenv(contents: Record<RecordKey, string> | DotenvParseOutput, options?: StringifyDotenvOptions): string;
|
|
531
571
|
//#endregion
|
|
532
|
-
//#region src/functions/miscellaneous/stringListToArray.d.ts
|
|
572
|
+
//#region src/root/functions/miscellaneous/stringListToArray.d.ts
|
|
533
573
|
/**
|
|
534
574
|
* Options to apply to the conversion of a string list to an array.
|
|
535
575
|
*
|
|
@@ -558,7 +598,7 @@ declare function stringListToArray(stringList: string, {
|
|
|
558
598
|
trimWhitespace
|
|
559
599
|
}?: StringListToArrayOptions): string[];
|
|
560
600
|
//#endregion
|
|
561
|
-
//#region src/functions/miscellaneous/wait.d.ts
|
|
601
|
+
//#region src/root/functions/miscellaneous/wait.d.ts
|
|
562
602
|
/**
|
|
563
603
|
* Waits for the given number of seconds
|
|
564
604
|
*
|
|
@@ -570,7 +610,7 @@ declare function stringListToArray(stringList: string, {
|
|
|
570
610
|
*/
|
|
571
611
|
declare function wait(seconds: number): Promise<void>;
|
|
572
612
|
//#endregion
|
|
573
|
-
//#region src/functions/objectHelpers/getRecordKeys.d.ts
|
|
613
|
+
//#region src/root/functions/objectHelpers/getRecordKeys.d.ts
|
|
574
614
|
/**
|
|
575
615
|
* Gets the keys from a given record object, properly typed to be an array of the key of the input object's type.
|
|
576
616
|
*
|
|
@@ -584,7 +624,7 @@ declare function wait(seconds: number): Promise<void>;
|
|
|
584
624
|
*/
|
|
585
625
|
declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown>>(record: InputRecordType & object): (keyof InputRecordType)[];
|
|
586
626
|
//#endregion
|
|
587
|
-
//#region src/functions/objectHelpers/omitProperties.d.ts
|
|
627
|
+
//#region src/root/functions/objectHelpers/omitProperties.d.ts
|
|
588
628
|
/**
|
|
589
629
|
* Omits properties from a given object.
|
|
590
630
|
*
|
|
@@ -600,7 +640,7 @@ declare function getRecordKeys<InputRecordType extends Record<RecordKey, unknown
|
|
|
600
640
|
*/
|
|
601
641
|
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
642
|
//#endregion
|
|
603
|
-
//#region src/functions/objectHelpers/removeUndefinedFromObject.d.ts
|
|
643
|
+
//#region src/root/functions/objectHelpers/removeUndefinedFromObject.d.ts
|
|
604
644
|
type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in keyof RecordType]: Exclude<RecordType[Key], undefined> };
|
|
605
645
|
/**
|
|
606
646
|
* Removes entries whose values are `undefined` from a given object (not including null etc.).
|
|
@@ -611,7 +651,7 @@ type RemoveUndefined<RecordType extends Record<RecordKey, unknown>> = { [Key in
|
|
|
611
651
|
*/
|
|
612
652
|
declare function removeUndefinedFromObject<RecordType extends Record<RecordKey, unknown>>(object: RecordType): RemoveUndefined<RecordType>;
|
|
613
653
|
//#endregion
|
|
614
|
-
//#region src/functions/parsers/parseBoolean.d.ts
|
|
654
|
+
//#region src/root/functions/parsers/parseBoolean.d.ts
|
|
615
655
|
/**
|
|
616
656
|
* Takes a stringly-typed boolean and converts it to an actual boolean type.
|
|
617
657
|
*
|
|
@@ -625,7 +665,7 @@ declare function removeUndefinedFromObject<RecordType extends Record<RecordKey,
|
|
|
625
665
|
*/
|
|
626
666
|
declare function parseBoolean(inputString: string): boolean;
|
|
627
667
|
//#endregion
|
|
628
|
-
//#region src/functions/parsers/parseEnv.d.ts
|
|
668
|
+
//#region src/root/functions/parsers/parseEnv.d.ts
|
|
629
669
|
/**
|
|
630
670
|
* Represents the three common development environments.
|
|
631
671
|
*
|
|
@@ -642,15 +682,15 @@ type Env = CreateEnumType<typeof Env>;
|
|
|
642
682
|
*
|
|
643
683
|
* @category Parsers
|
|
644
684
|
*
|
|
645
|
-
* @param
|
|
685
|
+
* @param input - The data to parse.
|
|
646
686
|
*
|
|
647
687
|
* @throws {DataError} If the data does not match one of the environments allowed by the Env types ("test" | "development" | "production").
|
|
648
688
|
*
|
|
649
689
|
* @returns The specified environment if allowed.
|
|
650
690
|
*/
|
|
651
|
-
declare function parseEnv(
|
|
691
|
+
declare function parseEnv(input: unknown): Env;
|
|
652
692
|
//#endregion
|
|
653
|
-
//#region src/functions/parsers/parseFilePath.d.ts
|
|
693
|
+
//#region src/root/functions/parsers/parseFilePath.d.ts
|
|
654
694
|
interface FilePathData {
|
|
655
695
|
/** The file path without the final part. */
|
|
656
696
|
directory: string;
|
|
@@ -672,7 +712,7 @@ interface FilePathData {
|
|
|
672
712
|
*/
|
|
673
713
|
declare function parseFilePath(filePath: string): FilePathData;
|
|
674
714
|
//#endregion
|
|
675
|
-
//#region src/functions/parsers/parseFormData.d.ts
|
|
715
|
+
//#region src/root/functions/parsers/parseFormData.d.ts
|
|
676
716
|
/**
|
|
677
717
|
* Returns a parsed object given FormData and a data parser function to call on the resulting object.
|
|
678
718
|
*
|
|
@@ -693,7 +733,7 @@ declare function parseFormData<DataType>(formData: FormData, dataParser: (data:
|
|
|
693
733
|
*/
|
|
694
734
|
declare function parseFormData(formData: FormData): Record<string, string | Blob>;
|
|
695
735
|
//#endregion
|
|
696
|
-
//#region src/functions/parsers/parseIntStrict.d.ts
|
|
736
|
+
//#region src/root/functions/parsers/parseIntStrict.d.ts
|
|
697
737
|
/**
|
|
698
738
|
* Converts a string to an integer and throws an error if it cannot be converted.
|
|
699
739
|
*
|
|
@@ -708,7 +748,7 @@ declare function parseFormData(formData: FormData): Record<string, string | Blob
|
|
|
708
748
|
*/
|
|
709
749
|
declare function parseIntStrict(string: string, radix?: number): number;
|
|
710
750
|
//#endregion
|
|
711
|
-
//#region src/functions/parsers/parseVersionType.d.ts
|
|
751
|
+
//#region src/root/functions/parsers/parseVersionType.d.ts
|
|
712
752
|
/**
|
|
713
753
|
* Represents the three common software version types.
|
|
714
754
|
*
|
|
@@ -725,15 +765,15 @@ type VersionType = CreateEnumType<typeof VersionType>;
|
|
|
725
765
|
*
|
|
726
766
|
* @category Parsers
|
|
727
767
|
*
|
|
728
|
-
* @param
|
|
768
|
+
* @param input - The data to parse.
|
|
729
769
|
*
|
|
730
770
|
* @throws {DataError} If the data does not match one of the allowed version types (`"major" | "minor" | "patch"`).
|
|
731
771
|
*
|
|
732
772
|
* @returns The given version type if allowed.
|
|
733
773
|
*/
|
|
734
|
-
declare function parseVersionType(
|
|
774
|
+
declare function parseVersionType(input: unknown): VersionType;
|
|
735
775
|
//#endregion
|
|
736
|
-
//#region src/functions/parsers/zod/parseZodSchema.d.ts
|
|
776
|
+
//#region src/root/functions/parsers/zod/parseZodSchema.d.ts
|
|
737
777
|
/**
|
|
738
778
|
* An alternative function to zodSchema.parse() that can be used to strictly parse Zod schemas.
|
|
739
779
|
*
|
|
@@ -745,16 +785,16 @@ declare function parseVersionType(data: unknown): VersionType;
|
|
|
745
785
|
* @template ErrorType - The type of error to throw on invalid data.
|
|
746
786
|
*
|
|
747
787
|
* @param schema - The Zod schema to use in parsing.
|
|
748
|
-
* @param
|
|
788
|
+
* @param input - The data to parse.
|
|
749
789
|
* @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
790
|
*
|
|
751
791
|
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
752
792
|
*
|
|
753
793
|
* @returns The parsed data from the Zod schema.
|
|
754
794
|
*/
|
|
755
|
-
declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType,
|
|
795
|
+
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
796
|
//#endregion
|
|
757
|
-
//#region src/functions/parsers/zod/parseZodSchemaAsync.d.ts
|
|
797
|
+
//#region src/root/functions/parsers/zod/parseZodSchemaAsync.d.ts
|
|
758
798
|
/**
|
|
759
799
|
* An alternative function to zodSchema.parseAsync() that can be used to strictly parse asynchronous Zod schemas.
|
|
760
800
|
*
|
|
@@ -764,16 +804,16 @@ declare function parseZodSchema<SchemaType extends ZodType, ErrorType extends Er
|
|
|
764
804
|
* @template ErrorType - The type of error to throw on invalid data.
|
|
765
805
|
*
|
|
766
806
|
* @param schema - The Zod schema to use in parsing.
|
|
767
|
-
* @param
|
|
807
|
+
* @param input - The data to parse.
|
|
768
808
|
* @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
809
|
*
|
|
770
810
|
* @throws {DataError} If the given data cannot be parsed according to the schema.
|
|
771
811
|
*
|
|
772
812
|
* @returns The parsed data from the Zod schema.
|
|
773
813
|
*/
|
|
774
|
-
declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType extends Error = DataError>(schema: SchemaType,
|
|
814
|
+
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
815
|
//#endregion
|
|
776
|
-
//#region src/functions/recursive/deepCopy.d.ts
|
|
816
|
+
//#region src/root/functions/recursive/deepCopy.d.ts
|
|
777
817
|
/**
|
|
778
818
|
* Deeply copies an object or array such that all child objects/arrays are also copied.
|
|
779
819
|
*
|
|
@@ -787,7 +827,7 @@ declare function parseZodSchemaAsync<SchemaType extends ZodType, ErrorType exten
|
|
|
787
827
|
*/
|
|
788
828
|
declare function deepCopy<ObjectType extends object>(object: ObjectType): ObjectType;
|
|
789
829
|
//#endregion
|
|
790
|
-
//#region src/functions/recursive/deepFreeze.d.ts
|
|
830
|
+
//#region src/root/functions/recursive/deepFreeze.d.ts
|
|
791
831
|
/**
|
|
792
832
|
* Deeply freezes an object or array such that all child objects/arrays are also frozen.
|
|
793
833
|
*
|
|
@@ -804,7 +844,7 @@ declare function deepCopy<ObjectType extends object>(object: ObjectType): Object
|
|
|
804
844
|
*/
|
|
805
845
|
declare function deepFreeze<ObjectType extends object>(object: ObjectType): Readonly<ObjectType>;
|
|
806
846
|
//#endregion
|
|
807
|
-
//#region src/functions/security/encryptWithKey.d.ts
|
|
847
|
+
//#region src/root/functions/security/encryptWithKey.d.ts
|
|
808
848
|
/**
|
|
809
849
|
* Encrypt a secret given the public base64 key and the thing you want to encrypt.
|
|
810
850
|
*
|
|
@@ -815,57 +855,7 @@ declare function deepFreeze<ObjectType extends object>(object: ObjectType): Read
|
|
|
815
855
|
*/
|
|
816
856
|
declare function encryptWithKey(publicKey: string, plaintextValue: string): Promise<string>;
|
|
817
857
|
//#endregion
|
|
818
|
-
//#region src/functions/
|
|
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
|
|
858
|
+
//#region src/root/functions/stringHelpers/appendSemicolon.d.ts
|
|
869
859
|
/**
|
|
870
860
|
* Appends a semicolon to the end of a string, trimming where necessary first.
|
|
871
861
|
*
|
|
@@ -879,7 +869,7 @@ declare function getPublicAndPrivateKey(outputFormat: "text" | "hex" | "base64")
|
|
|
879
869
|
*/
|
|
880
870
|
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
881
871
|
//#endregion
|
|
882
|
-
//#region src/functions/stringHelpers/camelToKebab.d.ts
|
|
872
|
+
//#region src/root/functions/stringHelpers/camelToKebab.d.ts
|
|
883
873
|
/**
|
|
884
874
|
* Options to apply to the conversion from camelCase to kebab-case
|
|
885
875
|
*
|
|
@@ -901,7 +891,7 @@ interface CamelToKebabOptions {
|
|
|
901
891
|
*/
|
|
902
892
|
declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
|
|
903
893
|
//#endregion
|
|
904
|
-
//#region src/functions/stringHelpers/kebabToCamel.d.ts
|
|
894
|
+
//#region src/root/functions/stringHelpers/kebabToCamel.d.ts
|
|
905
895
|
/**
|
|
906
896
|
* Options to apply to the conversion from kebab-case to camelCase
|
|
907
897
|
*
|
|
@@ -923,39 +913,7 @@ interface KebabToCamelOptions {
|
|
|
923
913
|
*/
|
|
924
914
|
declare function kebabToCamel(string: string, options?: KebabToCamelOptions): string;
|
|
925
915
|
//#endregion
|
|
926
|
-
//#region src/functions/stringHelpers/
|
|
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
|
|
916
|
+
//#region src/root/functions/stringHelpers/truncate.d.ts
|
|
959
917
|
/**
|
|
960
918
|
* Truncates a string and appends `...` to the end of it
|
|
961
919
|
*
|
|
@@ -968,7 +926,7 @@ declare const normaliseImportPath: typeof normalizeImportPath;
|
|
|
968
926
|
*/
|
|
969
927
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
970
928
|
//#endregion
|
|
971
|
-
//#region src/functions/taggedTemplate/createTemplateStringsArray.d.ts
|
|
929
|
+
//#region src/root/functions/taggedTemplate/createTemplateStringsArray.d.ts
|
|
972
930
|
/**
|
|
973
931
|
* Creates a template strings array given a regular array of strings
|
|
974
932
|
*
|
|
@@ -980,28 +938,7 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
|
980
938
|
*/
|
|
981
939
|
declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
|
|
982
940
|
//#endregion
|
|
983
|
-
//#region src/functions/taggedTemplate/
|
|
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
|
|
941
|
+
//#region src/root/functions/taggedTemplate/getStringsAndInterpolations.d.ts
|
|
1005
942
|
/**
|
|
1006
943
|
*
|
|
1007
944
|
* Gets the strings and interpolations separately from a template string.
|
|
@@ -1033,7 +970,7 @@ declare function getInterpolations(strings: TemplateStringsArray, ...interpolati
|
|
|
1033
970
|
*/
|
|
1034
971
|
declare function getStringsAndInterpolations<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): [TemplateStringsArray, ...InterpolationsType];
|
|
1035
972
|
//#endregion
|
|
1036
|
-
//#region src/functions/taggedTemplate/interpolate.d.ts
|
|
973
|
+
//#region src/root/functions/taggedTemplate/interpolate.d.ts
|
|
1037
974
|
/**
|
|
1038
975
|
* Returns the result of interpolating a template string when given the strings and interpolations separately.
|
|
1039
976
|
*
|
|
@@ -1056,7 +993,7 @@ declare function getStringsAndInterpolations<const InterpolationsType extends re
|
|
|
1056
993
|
*/
|
|
1057
994
|
declare function interpolate<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
|
|
1058
995
|
//#endregion
|
|
1059
|
-
//#region src/functions/taggedTemplate/interpolateObjects.d.ts
|
|
996
|
+
//#region src/root/functions/taggedTemplate/interpolateObjects.d.ts
|
|
1060
997
|
/**
|
|
1061
998
|
* Returns the result of interpolating a template string, also stringifying objects.
|
|
1062
999
|
*
|
|
@@ -1077,7 +1014,7 @@ declare function interpolate<const InterpolationsType extends readonly unknown[]
|
|
|
1077
1014
|
*/
|
|
1078
1015
|
declare function interpolateObjects<const InterpolationsType extends readonly unknown[]>(strings: TemplateStringsArray, ...interpolations: InterpolationsType): string;
|
|
1079
1016
|
//#endregion
|
|
1080
|
-
//#region src/functions/taggedTemplate/isTemplateStringsArray.d.ts
|
|
1017
|
+
//#region src/root/functions/taggedTemplate/isTemplateStringsArray.d.ts
|
|
1081
1018
|
/**
|
|
1082
1019
|
* Determines whether or not the input is a valid `TemplateStringsArray`.
|
|
1083
1020
|
*
|
|
@@ -1089,7 +1026,7 @@ declare function interpolateObjects<const InterpolationsType extends readonly un
|
|
|
1089
1026
|
*/
|
|
1090
1027
|
declare function isTemplateStringsArray(input: unknown): input is TemplateStringsArray;
|
|
1091
1028
|
//#endregion
|
|
1092
|
-
//#region src/functions/taggedTemplate/normaliseIndents.d.ts
|
|
1029
|
+
//#region src/root/functions/taggedTemplate/normaliseIndents.d.ts
|
|
1093
1030
|
/**
|
|
1094
1031
|
* Options to apply to the normalisation of indents in multi-line template strings
|
|
1095
1032
|
*
|
|
@@ -1157,75 +1094,4 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
|
|
|
1157
1094
|
*/
|
|
1158
1095
|
declare const normalizeIndents: typeof normaliseIndents;
|
|
1159
1096
|
//#endregion
|
|
1160
|
-
|
|
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 };
|
|
1097
|
+
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 };
|