@alextheman/utility 2.20.0 → 3.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 +447 -566
- package/dist/index.d.cts +114 -68
- package/dist/index.d.ts +114 -68
- package/dist/index.js +389 -504
- package/package.json +8 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,136 +1,182 @@
|
|
|
1
|
-
import z, { z as z$1 } from
|
|
1
|
+
import z, { ZodType, core, z as z$1 } from "zod";
|
|
2
2
|
|
|
3
|
+
//#region src/functions/addDaysToDate.d.ts
|
|
3
4
|
declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
|
|
4
|
-
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/functions/appendSemicolon.d.ts
|
|
5
7
|
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
6
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/functions/camelToKebab.d.ts
|
|
7
10
|
declare function camelToKebab(string: string): string;
|
|
8
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/functions/convertFileToBase64.d.ts
|
|
9
13
|
declare function convertFileToBase64(file: File): Promise<string>;
|
|
10
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/types/APIError.d.ts
|
|
11
16
|
type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
|
|
12
|
-
/** @deprecated This type has been renamed to HTTPErrorCode (singular) */
|
|
13
|
-
type HTTPErrorCodes = 400 | 401 | 403 | 404 | 418 | 500;
|
|
14
17
|
declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
|
|
15
18
|
declare class APIError extends Error {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
status: number;
|
|
20
|
+
constructor(status?: HTTPErrorCode | number, message?: string, options?: ErrorOptions);
|
|
21
|
+
static check(input: unknown): input is APIError;
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/types/DataError.d.ts
|
|
25
|
+
declare class DataError extends Error {
|
|
26
|
+
data: unknown;
|
|
27
|
+
code: string;
|
|
28
|
+
/** @param data - The data that caused the error. */
|
|
29
|
+
/** @param message - A human-readable error message (e.g. The data provided is invalid). */
|
|
30
|
+
/** @param code - A standardised code (e.g. UNEXPECTED_DATA). */
|
|
31
|
+
/** @param options - Extra options to pass to super Error constructor. */
|
|
32
|
+
constructor(data: unknown, message?: string, code?: string, options?: ErrorOptions);
|
|
33
|
+
static check(input: unknown): input is DataError;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/types/Email.d.ts
|
|
21
37
|
declare const emailSchema: z.core.$ZodBranded<z.ZodEmail, "Email">;
|
|
22
38
|
type Email = z.infer<typeof emailSchema>;
|
|
23
39
|
declare function parseEmail(data: unknown): Email;
|
|
24
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/Env.d.ts
|
|
25
42
|
declare const envSchema: z$1.ZodEnum<{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
test: "test";
|
|
44
|
+
development: "development";
|
|
45
|
+
production: "production";
|
|
29
46
|
}>;
|
|
30
47
|
type Env = z$1.infer<typeof envSchema>;
|
|
31
48
|
declare function parseEnv(data?: unknown): Env;
|
|
32
|
-
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/types/UUID.d.ts
|
|
33
51
|
declare const uuidSchema: z.core.$ZodBranded<z.ZodUUID, "UUID">;
|
|
34
52
|
type UUID = z.infer<typeof uuidSchema>;
|
|
35
53
|
declare function parseUUID(UUID: unknown): UUID;
|
|
36
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/types/DisallowUndefined.d.ts
|
|
37
56
|
type DisallowUndefined<T> = undefined extends T ? ["Error: Generic type cannot include undefined"] : T;
|
|
38
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/types/IgnoreCase.d.ts
|
|
39
59
|
type IgnoreCase<T extends string> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${IgnoreCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${IgnoreCase<R>}` : "";
|
|
40
|
-
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/types/NonUndefined.d.ts
|
|
41
62
|
type NonUndefined<T> = T extends undefined ? never : T;
|
|
42
|
-
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/types/OptionalOnCondition.d.ts
|
|
43
65
|
type OptionalOnCondition<Condition extends boolean, T> = Condition extends true ? T : T | undefined;
|
|
44
|
-
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/types/RecordKey.d.ts
|
|
45
68
|
type RecordKey = string | number | symbol;
|
|
46
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/functions/createFormData.d.ts
|
|
47
71
|
type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
|
|
48
72
|
type FormDataArrayResolutionStrategy = "stringify" | "multiple";
|
|
49
73
|
interface CreateFormDataOptionsBase<K extends RecordKey> {
|
|
50
|
-
|
|
74
|
+
arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<K, FormDataArrayResolutionStrategy>>;
|
|
51
75
|
}
|
|
52
76
|
interface CreateFormDataOptionsUndefinedOrNullResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
78
|
+
nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
79
|
+
nullableResolution?: never;
|
|
56
80
|
}
|
|
57
81
|
interface CreateFormDataOptionsNullableResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
undefinedResolution?: never;
|
|
83
|
+
nullResolution?: never;
|
|
84
|
+
nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
61
85
|
}
|
|
62
86
|
type CreateFormDataOptions<K extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<K> | CreateFormDataOptionsNullableResolution<K>;
|
|
63
87
|
declare function createFormData<T extends Record<RecordKey, unknown>>(data: T, options?: CreateFormDataOptions<keyof T>): FormData;
|
|
64
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/functions/createTemplateStringsArray.d.ts
|
|
65
90
|
declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
|
|
66
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/functions/fillArray.d.ts
|
|
67
93
|
declare function fillArray<T>(callback: (index: number) => Promise<T>, length?: number): Promise<T[]>;
|
|
68
94
|
declare function fillArray<T>(callback: (index: number) => T, length?: number): T[];
|
|
69
|
-
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/functions/formatDateAndTime.d.ts
|
|
70
97
|
declare function formatDateAndTime(inputDate: Date): string;
|
|
71
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/functions/getRandomNumber.d.ts
|
|
72
100
|
declare function getRandomNumber(lowerBound: number, upperBound: number): number;
|
|
73
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/functions/getRecordKeys.d.ts
|
|
74
103
|
declare function getRecordKeys<T extends Record<RecordKey, unknown>>(record: T & object): (keyof T)[];
|
|
75
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/functions/isLeapYear.d.ts
|
|
76
106
|
declare function isLeapYear(year: number): boolean;
|
|
77
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/functions/isMonthlyMultiple.d.ts
|
|
78
109
|
declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
|
|
79
|
-
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/functions/isOrdered.d.ts
|
|
80
112
|
declare function isOrdered(array: readonly number[] | number[]): boolean;
|
|
81
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/functions/isSameDate.d.ts
|
|
82
115
|
declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
83
|
-
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/functions/kebabToCamel.d.ts
|
|
84
118
|
interface KebabToCamelOptions {
|
|
85
|
-
|
|
119
|
+
startWithUpper?: boolean;
|
|
86
120
|
}
|
|
87
121
|
declare function kebabToCamel(string: string, options?: KebabToCamelOptions): string;
|
|
88
|
-
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/functions/normalizeImportPath.d.ts
|
|
89
124
|
declare function normalizeImportPath(importPath: string): string;
|
|
90
125
|
declare const normaliseImportPath: typeof normalizeImportPath;
|
|
91
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/functions/omitProperties.d.ts
|
|
92
128
|
declare function omitProperties<T extends Record<string, unknown> | Readonly<Record<string, unknown>>, K extends keyof T>(object: T, keysToOmit: K | readonly K[]): Omit<T, K>;
|
|
93
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/functions/paralleliseArrays.d.ts
|
|
94
131
|
type ParallelTuple<A, B> = [A, B | undefined];
|
|
95
132
|
declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: FirstArrayItem[] | readonly FirstArrayItem[], secondArray: SecondArrayItem[] | readonly SecondArrayItem[]): ParallelTuple<FirstArrayItem, SecondArrayItem>[];
|
|
96
|
-
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/functions/parseIntStrict.d.ts
|
|
97
135
|
declare function parseIntStrict(...[string, radix]: Parameters<typeof parseInt>): number;
|
|
98
|
-
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/functions/parseZodSchema.d.ts
|
|
138
|
+
declare function parseZodSchema<Output, Input, Internals extends core.$ZodTypeInternals<Output, Input>>(schema: ZodType<Output, Input, Internals>, data: unknown): core.output<ZodType<Output, Input, Internals>>;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/functions/randomiseArray.d.ts
|
|
99
141
|
declare function randomiseArray<T>(array: T[]): T[];
|
|
100
|
-
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/functions/range.d.ts
|
|
101
144
|
declare function range(start: number, stop: number, step?: number): number[];
|
|
102
|
-
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/functions/removeDuplicates.d.ts
|
|
103
147
|
declare function removeDuplicates<T>(array: T[] | readonly T[]): T[];
|
|
104
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/functions/stringListToArray.d.ts
|
|
105
150
|
interface StringListToArrayOptions {
|
|
106
|
-
|
|
107
|
-
|
|
151
|
+
separator?: string;
|
|
152
|
+
trimWhitespace?: boolean;
|
|
108
153
|
}
|
|
109
|
-
declare function stringListToArray(stringList: string, {
|
|
110
|
-
|
|
154
|
+
declare function stringListToArray(stringList: string, {
|
|
155
|
+
separator,
|
|
156
|
+
trimWhitespace
|
|
157
|
+
}?: StringListToArrayOptions): string[];
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/functions/stringToBoolean.d.ts
|
|
111
160
|
declare function stringToBoolean(inputString: string): boolean;
|
|
112
|
-
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/functions/truncate.d.ts
|
|
113
163
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
114
|
-
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/functions/wait.d.ts
|
|
115
166
|
declare function wait(seconds: number): Promise<void>;
|
|
116
|
-
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/functions/taggedTemplate/interpolate.d.ts
|
|
117
169
|
declare function interpolate(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
118
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/functions/taggedTemplate/interpolateObjects.d.ts
|
|
119
172
|
declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
120
|
-
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/functions/taggedTemplate/removeIndents.d.ts
|
|
121
175
|
interface RemoveIndentsOptions {
|
|
122
|
-
|
|
176
|
+
preserveTabs?: boolean;
|
|
123
177
|
}
|
|
124
178
|
type RemoveIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
125
179
|
declare function removeIndents(options: RemoveIndentsOptions): RemoveIndentsFunction;
|
|
126
180
|
declare function removeIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
whitespaceLength?: number;
|
|
130
|
-
preserveTabs?: boolean;
|
|
131
|
-
}
|
|
132
|
-
type StripIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
133
|
-
declare function stripIndents(options: StripIndentsOptions): StripIndentsFunction;
|
|
134
|
-
declare function stripIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
135
|
-
|
|
136
|
-
export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type HTTPErrorCodes, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, type RemoveIndentsFunction, type RemoveIndentsOptions, type StringListToArrayOptions, type StripIndentsFunction, type StripIndentsOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolate, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normalizeImportPath, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, removeIndents, stringListToArray, stringToBoolean, stripIndents, truncate, wait };
|
|
181
|
+
//#endregion
|
|
182
|
+
export { APIError, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Email, Env, FormDataNullableResolutionStrategy as FormDataResolutionStrategy, HTTPErrorCode, IgnoreCase, KebabToCamelOptions, NonUndefined, OptionalOnCondition, RecordKey, RemoveIndentsFunction, RemoveIndentsOptions, StringListToArrayOptions, UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolate, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normalizeImportPath, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, parseZodSchema, randomiseArray, range, removeDuplicates, removeIndents, stringListToArray, stringToBoolean, truncate, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,136 +1,182 @@
|
|
|
1
|
-
import z, { z as z$1 } from
|
|
1
|
+
import z, { ZodType, core, z as z$1 } from "zod";
|
|
2
2
|
|
|
3
|
+
//#region src/functions/addDaysToDate.d.ts
|
|
3
4
|
declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
|
|
4
|
-
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/functions/appendSemicolon.d.ts
|
|
5
7
|
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
6
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/functions/camelToKebab.d.ts
|
|
7
10
|
declare function camelToKebab(string: string): string;
|
|
8
|
-
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/functions/convertFileToBase64.d.ts
|
|
9
13
|
declare function convertFileToBase64(file: File): Promise<string>;
|
|
10
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/types/APIError.d.ts
|
|
11
16
|
type HTTPErrorCode = 400 | 401 | 403 | 404 | 418 | 500;
|
|
12
|
-
/** @deprecated This type has been renamed to HTTPErrorCode (singular) */
|
|
13
|
-
type HTTPErrorCodes = 400 | 401 | 403 | 404 | 418 | 500;
|
|
14
17
|
declare const httpErrorCodeLookup: Record<HTTPErrorCode, string>;
|
|
15
18
|
declare class APIError extends Error {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
status: number;
|
|
20
|
+
constructor(status?: HTTPErrorCode | number, message?: string, options?: ErrorOptions);
|
|
21
|
+
static check(input: unknown): input is APIError;
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/types/DataError.d.ts
|
|
25
|
+
declare class DataError extends Error {
|
|
26
|
+
data: unknown;
|
|
27
|
+
code: string;
|
|
28
|
+
/** @param data - The data that caused the error. */
|
|
29
|
+
/** @param message - A human-readable error message (e.g. The data provided is invalid). */
|
|
30
|
+
/** @param code - A standardised code (e.g. UNEXPECTED_DATA). */
|
|
31
|
+
/** @param options - Extra options to pass to super Error constructor. */
|
|
32
|
+
constructor(data: unknown, message?: string, code?: string, options?: ErrorOptions);
|
|
33
|
+
static check(input: unknown): input is DataError;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/types/Email.d.ts
|
|
21
37
|
declare const emailSchema: z.core.$ZodBranded<z.ZodEmail, "Email">;
|
|
22
38
|
type Email = z.infer<typeof emailSchema>;
|
|
23
39
|
declare function parseEmail(data: unknown): Email;
|
|
24
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/Env.d.ts
|
|
25
42
|
declare const envSchema: z$1.ZodEnum<{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
test: "test";
|
|
44
|
+
development: "development";
|
|
45
|
+
production: "production";
|
|
29
46
|
}>;
|
|
30
47
|
type Env = z$1.infer<typeof envSchema>;
|
|
31
48
|
declare function parseEnv(data?: unknown): Env;
|
|
32
|
-
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/types/UUID.d.ts
|
|
33
51
|
declare const uuidSchema: z.core.$ZodBranded<z.ZodUUID, "UUID">;
|
|
34
52
|
type UUID = z.infer<typeof uuidSchema>;
|
|
35
53
|
declare function parseUUID(UUID: unknown): UUID;
|
|
36
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/types/DisallowUndefined.d.ts
|
|
37
56
|
type DisallowUndefined<T> = undefined extends T ? ["Error: Generic type cannot include undefined"] : T;
|
|
38
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/types/IgnoreCase.d.ts
|
|
39
59
|
type IgnoreCase<T extends string> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${IgnoreCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${IgnoreCase<R>}` : "";
|
|
40
|
-
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/types/NonUndefined.d.ts
|
|
41
62
|
type NonUndefined<T> = T extends undefined ? never : T;
|
|
42
|
-
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/types/OptionalOnCondition.d.ts
|
|
43
65
|
type OptionalOnCondition<Condition extends boolean, T> = Condition extends true ? T : T | undefined;
|
|
44
|
-
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/types/RecordKey.d.ts
|
|
45
68
|
type RecordKey = string | number | symbol;
|
|
46
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/functions/createFormData.d.ts
|
|
47
71
|
type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
|
|
48
72
|
type FormDataArrayResolutionStrategy = "stringify" | "multiple";
|
|
49
73
|
interface CreateFormDataOptionsBase<K extends RecordKey> {
|
|
50
|
-
|
|
74
|
+
arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<K, FormDataArrayResolutionStrategy>>;
|
|
51
75
|
}
|
|
52
76
|
interface CreateFormDataOptionsUndefinedOrNullResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
77
|
+
undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
78
|
+
nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
79
|
+
nullableResolution?: never;
|
|
56
80
|
}
|
|
57
81
|
interface CreateFormDataOptionsNullableResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
82
|
+
undefinedResolution?: never;
|
|
83
|
+
nullResolution?: never;
|
|
84
|
+
nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
61
85
|
}
|
|
62
86
|
type CreateFormDataOptions<K extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<K> | CreateFormDataOptionsNullableResolution<K>;
|
|
63
87
|
declare function createFormData<T extends Record<RecordKey, unknown>>(data: T, options?: CreateFormDataOptions<keyof T>): FormData;
|
|
64
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/functions/createTemplateStringsArray.d.ts
|
|
65
90
|
declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
|
|
66
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/functions/fillArray.d.ts
|
|
67
93
|
declare function fillArray<T>(callback: (index: number) => Promise<T>, length?: number): Promise<T[]>;
|
|
68
94
|
declare function fillArray<T>(callback: (index: number) => T, length?: number): T[];
|
|
69
|
-
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/functions/formatDateAndTime.d.ts
|
|
70
97
|
declare function formatDateAndTime(inputDate: Date): string;
|
|
71
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/functions/getRandomNumber.d.ts
|
|
72
100
|
declare function getRandomNumber(lowerBound: number, upperBound: number): number;
|
|
73
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/functions/getRecordKeys.d.ts
|
|
74
103
|
declare function getRecordKeys<T extends Record<RecordKey, unknown>>(record: T & object): (keyof T)[];
|
|
75
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/functions/isLeapYear.d.ts
|
|
76
106
|
declare function isLeapYear(year: number): boolean;
|
|
77
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/functions/isMonthlyMultiple.d.ts
|
|
78
109
|
declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
|
|
79
|
-
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/functions/isOrdered.d.ts
|
|
80
112
|
declare function isOrdered(array: readonly number[] | number[]): boolean;
|
|
81
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/functions/isSameDate.d.ts
|
|
82
115
|
declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
83
|
-
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/functions/kebabToCamel.d.ts
|
|
84
118
|
interface KebabToCamelOptions {
|
|
85
|
-
|
|
119
|
+
startWithUpper?: boolean;
|
|
86
120
|
}
|
|
87
121
|
declare function kebabToCamel(string: string, options?: KebabToCamelOptions): string;
|
|
88
|
-
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/functions/normalizeImportPath.d.ts
|
|
89
124
|
declare function normalizeImportPath(importPath: string): string;
|
|
90
125
|
declare const normaliseImportPath: typeof normalizeImportPath;
|
|
91
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/functions/omitProperties.d.ts
|
|
92
128
|
declare function omitProperties<T extends Record<string, unknown> | Readonly<Record<string, unknown>>, K extends keyof T>(object: T, keysToOmit: K | readonly K[]): Omit<T, K>;
|
|
93
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/functions/paralleliseArrays.d.ts
|
|
94
131
|
type ParallelTuple<A, B> = [A, B | undefined];
|
|
95
132
|
declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: FirstArrayItem[] | readonly FirstArrayItem[], secondArray: SecondArrayItem[] | readonly SecondArrayItem[]): ParallelTuple<FirstArrayItem, SecondArrayItem>[];
|
|
96
|
-
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/functions/parseIntStrict.d.ts
|
|
97
135
|
declare function parseIntStrict(...[string, radix]: Parameters<typeof parseInt>): number;
|
|
98
|
-
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/functions/parseZodSchema.d.ts
|
|
138
|
+
declare function parseZodSchema<Output, Input, Internals extends core.$ZodTypeInternals<Output, Input>>(schema: ZodType<Output, Input, Internals>, data: unknown): core.output<ZodType<Output, Input, Internals>>;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/functions/randomiseArray.d.ts
|
|
99
141
|
declare function randomiseArray<T>(array: T[]): T[];
|
|
100
|
-
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/functions/range.d.ts
|
|
101
144
|
declare function range(start: number, stop: number, step?: number): number[];
|
|
102
|
-
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/functions/removeDuplicates.d.ts
|
|
103
147
|
declare function removeDuplicates<T>(array: T[] | readonly T[]): T[];
|
|
104
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/functions/stringListToArray.d.ts
|
|
105
150
|
interface StringListToArrayOptions {
|
|
106
|
-
|
|
107
|
-
|
|
151
|
+
separator?: string;
|
|
152
|
+
trimWhitespace?: boolean;
|
|
108
153
|
}
|
|
109
|
-
declare function stringListToArray(stringList: string, {
|
|
110
|
-
|
|
154
|
+
declare function stringListToArray(stringList: string, {
|
|
155
|
+
separator,
|
|
156
|
+
trimWhitespace
|
|
157
|
+
}?: StringListToArrayOptions): string[];
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/functions/stringToBoolean.d.ts
|
|
111
160
|
declare function stringToBoolean(inputString: string): boolean;
|
|
112
|
-
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/functions/truncate.d.ts
|
|
113
163
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
114
|
-
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/functions/wait.d.ts
|
|
115
166
|
declare function wait(seconds: number): Promise<void>;
|
|
116
|
-
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/functions/taggedTemplate/interpolate.d.ts
|
|
117
169
|
declare function interpolate(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
118
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/functions/taggedTemplate/interpolateObjects.d.ts
|
|
119
172
|
declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
120
|
-
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/functions/taggedTemplate/removeIndents.d.ts
|
|
121
175
|
interface RemoveIndentsOptions {
|
|
122
|
-
|
|
176
|
+
preserveTabs?: boolean;
|
|
123
177
|
}
|
|
124
178
|
type RemoveIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
125
179
|
declare function removeIndents(options: RemoveIndentsOptions): RemoveIndentsFunction;
|
|
126
180
|
declare function removeIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
whitespaceLength?: number;
|
|
130
|
-
preserveTabs?: boolean;
|
|
131
|
-
}
|
|
132
|
-
type StripIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
133
|
-
declare function stripIndents(options: StripIndentsOptions): StripIndentsFunction;
|
|
134
|
-
declare function stripIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
135
|
-
|
|
136
|
-
export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type HTTPErrorCodes, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, type RemoveIndentsFunction, type RemoveIndentsOptions, type StringListToArrayOptions, type StripIndentsFunction, type StripIndentsOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolate, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normalizeImportPath, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, removeIndents, stringListToArray, stringToBoolean, stripIndents, truncate, wait };
|
|
181
|
+
//#endregion
|
|
182
|
+
export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, type Email, type Env, type FormDataNullableResolutionStrategy as FormDataResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type KebabToCamelOptions, type NonUndefined, type OptionalOnCondition, type RecordKey, RemoveIndentsFunction, RemoveIndentsOptions, type StringListToArrayOptions, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, httpErrorCodeLookup, interpolate, interpolateObjects, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normalizeImportPath, omitProperties, paralleliseArrays, parseEmail, parseEnv, parseIntStrict, parseUUID, parseZodSchema, randomiseArray, range, removeDuplicates, removeIndents, stringListToArray, stringToBoolean, truncate, wait };
|