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