@alextheman/utility 2.21.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 +422 -581
- package/dist/index.d.cts +111 -78
- package/dist/index.d.ts +111 -78
- package/dist/index.js +364 -517
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,149 +1,182 @@
|
|
|
1
|
-
import z, { z as z$1
|
|
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
|
|
21
25
|
declare class DataError extends Error {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/types/Email.d.ts
|
|
32
37
|
declare const emailSchema: z.core.$ZodBranded<z.ZodEmail, "Email">;
|
|
33
38
|
type Email = z.infer<typeof emailSchema>;
|
|
34
39
|
declare function parseEmail(data: unknown): Email;
|
|
35
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/Env.d.ts
|
|
36
42
|
declare const envSchema: z$1.ZodEnum<{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
test: "test";
|
|
44
|
+
development: "development";
|
|
45
|
+
production: "production";
|
|
40
46
|
}>;
|
|
41
47
|
type Env = z$1.infer<typeof envSchema>;
|
|
42
48
|
declare function parseEnv(data?: unknown): Env;
|
|
43
|
-
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/types/UUID.d.ts
|
|
44
51
|
declare const uuidSchema: z.core.$ZodBranded<z.ZodUUID, "UUID">;
|
|
45
52
|
type UUID = z.infer<typeof uuidSchema>;
|
|
46
53
|
declare function parseUUID(UUID: unknown): UUID;
|
|
47
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/types/DisallowUndefined.d.ts
|
|
48
56
|
type DisallowUndefined<T> = undefined extends T ? ["Error: Generic type cannot include undefined"] : T;
|
|
49
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/types/IgnoreCase.d.ts
|
|
50
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>}` : "";
|
|
51
|
-
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/types/NonUndefined.d.ts
|
|
52
62
|
type NonUndefined<T> = T extends undefined ? never : T;
|
|
53
|
-
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/types/OptionalOnCondition.d.ts
|
|
54
65
|
type OptionalOnCondition<Condition extends boolean, T> = Condition extends true ? T : T | undefined;
|
|
55
|
-
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/types/RecordKey.d.ts
|
|
56
68
|
type RecordKey = string | number | symbol;
|
|
57
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/functions/createFormData.d.ts
|
|
58
71
|
type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
|
|
59
72
|
type FormDataArrayResolutionStrategy = "stringify" | "multiple";
|
|
60
73
|
interface CreateFormDataOptionsBase<K extends RecordKey> {
|
|
61
|
-
|
|
74
|
+
arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<K, FormDataArrayResolutionStrategy>>;
|
|
62
75
|
}
|
|
63
76
|
interface CreateFormDataOptionsUndefinedOrNullResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
78
|
+
nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
79
|
+
nullableResolution?: never;
|
|
67
80
|
}
|
|
68
81
|
interface CreateFormDataOptionsNullableResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
undefinedResolution?: never;
|
|
83
|
+
nullResolution?: never;
|
|
84
|
+
nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
72
85
|
}
|
|
73
86
|
type CreateFormDataOptions<K extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<K> | CreateFormDataOptionsNullableResolution<K>;
|
|
74
87
|
declare function createFormData<T extends Record<RecordKey, unknown>>(data: T, options?: CreateFormDataOptions<keyof T>): FormData;
|
|
75
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/functions/createTemplateStringsArray.d.ts
|
|
76
90
|
declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
|
|
77
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/functions/fillArray.d.ts
|
|
78
93
|
declare function fillArray<T>(callback: (index: number) => Promise<T>, length?: number): Promise<T[]>;
|
|
79
94
|
declare function fillArray<T>(callback: (index: number) => T, length?: number): T[];
|
|
80
|
-
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/functions/formatDateAndTime.d.ts
|
|
81
97
|
declare function formatDateAndTime(inputDate: Date): string;
|
|
82
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/functions/getRandomNumber.d.ts
|
|
83
100
|
declare function getRandomNumber(lowerBound: number, upperBound: number): number;
|
|
84
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/functions/getRecordKeys.d.ts
|
|
85
103
|
declare function getRecordKeys<T extends Record<RecordKey, unknown>>(record: T & object): (keyof T)[];
|
|
86
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/functions/isLeapYear.d.ts
|
|
87
106
|
declare function isLeapYear(year: number): boolean;
|
|
88
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/functions/isMonthlyMultiple.d.ts
|
|
89
109
|
declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
|
|
90
|
-
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/functions/isOrdered.d.ts
|
|
91
112
|
declare function isOrdered(array: readonly number[] | number[]): boolean;
|
|
92
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/functions/isSameDate.d.ts
|
|
93
115
|
declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
94
|
-
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/functions/kebabToCamel.d.ts
|
|
95
118
|
interface KebabToCamelOptions {
|
|
96
|
-
|
|
119
|
+
startWithUpper?: boolean;
|
|
97
120
|
}
|
|
98
121
|
declare function kebabToCamel(string: string, options?: KebabToCamelOptions): string;
|
|
99
|
-
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/functions/normalizeImportPath.d.ts
|
|
100
124
|
declare function normalizeImportPath(importPath: string): string;
|
|
101
125
|
declare const normaliseImportPath: typeof normalizeImportPath;
|
|
102
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/functions/omitProperties.d.ts
|
|
103
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>;
|
|
104
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/functions/paralleliseArrays.d.ts
|
|
105
131
|
type ParallelTuple<A, B> = [A, B | undefined];
|
|
106
132
|
declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: FirstArrayItem[] | readonly FirstArrayItem[], secondArray: SecondArrayItem[] | readonly SecondArrayItem[]): ParallelTuple<FirstArrayItem, SecondArrayItem>[];
|
|
107
|
-
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/functions/parseIntStrict.d.ts
|
|
108
135
|
declare function parseIntStrict(...[string, radix]: Parameters<typeof parseInt>): number;
|
|
109
|
-
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/functions/parseZodSchema.d.ts
|
|
110
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>>;
|
|
111
|
-
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/functions/randomiseArray.d.ts
|
|
112
141
|
declare function randomiseArray<T>(array: T[]): T[];
|
|
113
|
-
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/functions/range.d.ts
|
|
114
144
|
declare function range(start: number, stop: number, step?: number): number[];
|
|
115
|
-
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/functions/removeDuplicates.d.ts
|
|
116
147
|
declare function removeDuplicates<T>(array: T[] | readonly T[]): T[];
|
|
117
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/functions/stringListToArray.d.ts
|
|
118
150
|
interface StringListToArrayOptions {
|
|
119
|
-
|
|
120
|
-
|
|
151
|
+
separator?: string;
|
|
152
|
+
trimWhitespace?: boolean;
|
|
121
153
|
}
|
|
122
|
-
declare function stringListToArray(stringList: string, {
|
|
123
|
-
|
|
154
|
+
declare function stringListToArray(stringList: string, {
|
|
155
|
+
separator,
|
|
156
|
+
trimWhitespace
|
|
157
|
+
}?: StringListToArrayOptions): string[];
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/functions/stringToBoolean.d.ts
|
|
124
160
|
declare function stringToBoolean(inputString: string): boolean;
|
|
125
|
-
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/functions/truncate.d.ts
|
|
126
163
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
127
|
-
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/functions/wait.d.ts
|
|
128
166
|
declare function wait(seconds: number): Promise<void>;
|
|
129
|
-
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/functions/taggedTemplate/interpolate.d.ts
|
|
130
169
|
declare function interpolate(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
131
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/functions/taggedTemplate/interpolateObjects.d.ts
|
|
132
172
|
declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
133
|
-
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/functions/taggedTemplate/removeIndents.d.ts
|
|
134
175
|
interface RemoveIndentsOptions {
|
|
135
|
-
|
|
176
|
+
preserveTabs?: boolean;
|
|
136
177
|
}
|
|
137
178
|
type RemoveIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
138
179
|
declare function removeIndents(options: RemoveIndentsOptions): RemoveIndentsFunction;
|
|
139
180
|
declare function removeIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
whitespaceLength?: number;
|
|
143
|
-
preserveTabs?: boolean;
|
|
144
|
-
}
|
|
145
|
-
type StripIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
146
|
-
declare function stripIndents(options: StripIndentsOptions): StripIndentsFunction;
|
|
147
|
-
declare function stripIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
148
|
-
|
|
149
|
-
export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, 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, parseZodSchema, 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,149 +1,182 @@
|
|
|
1
|
-
import z, { z as z$1
|
|
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
|
|
21
25
|
declare class DataError extends Error {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/types/Email.d.ts
|
|
32
37
|
declare const emailSchema: z.core.$ZodBranded<z.ZodEmail, "Email">;
|
|
33
38
|
type Email = z.infer<typeof emailSchema>;
|
|
34
39
|
declare function parseEmail(data: unknown): Email;
|
|
35
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types/Env.d.ts
|
|
36
42
|
declare const envSchema: z$1.ZodEnum<{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
test: "test";
|
|
44
|
+
development: "development";
|
|
45
|
+
production: "production";
|
|
40
46
|
}>;
|
|
41
47
|
type Env = z$1.infer<typeof envSchema>;
|
|
42
48
|
declare function parseEnv(data?: unknown): Env;
|
|
43
|
-
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/types/UUID.d.ts
|
|
44
51
|
declare const uuidSchema: z.core.$ZodBranded<z.ZodUUID, "UUID">;
|
|
45
52
|
type UUID = z.infer<typeof uuidSchema>;
|
|
46
53
|
declare function parseUUID(UUID: unknown): UUID;
|
|
47
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/types/DisallowUndefined.d.ts
|
|
48
56
|
type DisallowUndefined<T> = undefined extends T ? ["Error: Generic type cannot include undefined"] : T;
|
|
49
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/types/IgnoreCase.d.ts
|
|
50
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>}` : "";
|
|
51
|
-
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region src/types/NonUndefined.d.ts
|
|
52
62
|
type NonUndefined<T> = T extends undefined ? never : T;
|
|
53
|
-
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/types/OptionalOnCondition.d.ts
|
|
54
65
|
type OptionalOnCondition<Condition extends boolean, T> = Condition extends true ? T : T | undefined;
|
|
55
|
-
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/types/RecordKey.d.ts
|
|
56
68
|
type RecordKey = string | number | symbol;
|
|
57
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/functions/createFormData.d.ts
|
|
58
71
|
type FormDataNullableResolutionStrategy = "stringify" | "empty" | "omit";
|
|
59
72
|
type FormDataArrayResolutionStrategy = "stringify" | "multiple";
|
|
60
73
|
interface CreateFormDataOptionsBase<K extends RecordKey> {
|
|
61
|
-
|
|
74
|
+
arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<K, FormDataArrayResolutionStrategy>>;
|
|
62
75
|
}
|
|
63
76
|
interface CreateFormDataOptionsUndefinedOrNullResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
78
|
+
nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
79
|
+
nullableResolution?: never;
|
|
67
80
|
}
|
|
68
81
|
interface CreateFormDataOptionsNullableResolution<K extends RecordKey> extends CreateFormDataOptionsBase<K> {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
undefinedResolution?: never;
|
|
83
|
+
nullResolution?: never;
|
|
84
|
+
nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<K, FormDataNullableResolutionStrategy>>;
|
|
72
85
|
}
|
|
73
86
|
type CreateFormDataOptions<K extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<K> | CreateFormDataOptionsNullableResolution<K>;
|
|
74
87
|
declare function createFormData<T extends Record<RecordKey, unknown>>(data: T, options?: CreateFormDataOptions<keyof T>): FormData;
|
|
75
|
-
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/functions/createTemplateStringsArray.d.ts
|
|
76
90
|
declare function createTemplateStringsArray(strings: readonly string[]): TemplateStringsArray;
|
|
77
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/functions/fillArray.d.ts
|
|
78
93
|
declare function fillArray<T>(callback: (index: number) => Promise<T>, length?: number): Promise<T[]>;
|
|
79
94
|
declare function fillArray<T>(callback: (index: number) => T, length?: number): T[];
|
|
80
|
-
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/functions/formatDateAndTime.d.ts
|
|
81
97
|
declare function formatDateAndTime(inputDate: Date): string;
|
|
82
|
-
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/functions/getRandomNumber.d.ts
|
|
83
100
|
declare function getRandomNumber(lowerBound: number, upperBound: number): number;
|
|
84
|
-
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/functions/getRecordKeys.d.ts
|
|
85
103
|
declare function getRecordKeys<T extends Record<RecordKey, unknown>>(record: T & object): (keyof T)[];
|
|
86
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/functions/isLeapYear.d.ts
|
|
87
106
|
declare function isLeapYear(year: number): boolean;
|
|
88
|
-
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/functions/isMonthlyMultiple.d.ts
|
|
89
109
|
declare function isMonthlyMultiple(firstDate: Date, secondDate: Date): boolean;
|
|
90
|
-
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/functions/isOrdered.d.ts
|
|
91
112
|
declare function isOrdered(array: readonly number[] | number[]): boolean;
|
|
92
|
-
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/functions/isSameDate.d.ts
|
|
93
115
|
declare function isSameDate(firstDate: Date, secondDate: Date): boolean;
|
|
94
|
-
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/functions/kebabToCamel.d.ts
|
|
95
118
|
interface KebabToCamelOptions {
|
|
96
|
-
|
|
119
|
+
startWithUpper?: boolean;
|
|
97
120
|
}
|
|
98
121
|
declare function kebabToCamel(string: string, options?: KebabToCamelOptions): string;
|
|
99
|
-
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/functions/normalizeImportPath.d.ts
|
|
100
124
|
declare function normalizeImportPath(importPath: string): string;
|
|
101
125
|
declare const normaliseImportPath: typeof normalizeImportPath;
|
|
102
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/functions/omitProperties.d.ts
|
|
103
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>;
|
|
104
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/functions/paralleliseArrays.d.ts
|
|
105
131
|
type ParallelTuple<A, B> = [A, B | undefined];
|
|
106
132
|
declare function paralleliseArrays<FirstArrayItem, SecondArrayItem>(firstArray: FirstArrayItem[] | readonly FirstArrayItem[], secondArray: SecondArrayItem[] | readonly SecondArrayItem[]): ParallelTuple<FirstArrayItem, SecondArrayItem>[];
|
|
107
|
-
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/functions/parseIntStrict.d.ts
|
|
108
135
|
declare function parseIntStrict(...[string, radix]: Parameters<typeof parseInt>): number;
|
|
109
|
-
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/functions/parseZodSchema.d.ts
|
|
110
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>>;
|
|
111
|
-
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/functions/randomiseArray.d.ts
|
|
112
141
|
declare function randomiseArray<T>(array: T[]): T[];
|
|
113
|
-
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/functions/range.d.ts
|
|
114
144
|
declare function range(start: number, stop: number, step?: number): number[];
|
|
115
|
-
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/functions/removeDuplicates.d.ts
|
|
116
147
|
declare function removeDuplicates<T>(array: T[] | readonly T[]): T[];
|
|
117
|
-
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/functions/stringListToArray.d.ts
|
|
118
150
|
interface StringListToArrayOptions {
|
|
119
|
-
|
|
120
|
-
|
|
151
|
+
separator?: string;
|
|
152
|
+
trimWhitespace?: boolean;
|
|
121
153
|
}
|
|
122
|
-
declare function stringListToArray(stringList: string, {
|
|
123
|
-
|
|
154
|
+
declare function stringListToArray(stringList: string, {
|
|
155
|
+
separator,
|
|
156
|
+
trimWhitespace
|
|
157
|
+
}?: StringListToArrayOptions): string[];
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/functions/stringToBoolean.d.ts
|
|
124
160
|
declare function stringToBoolean(inputString: string): boolean;
|
|
125
|
-
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/functions/truncate.d.ts
|
|
126
163
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
127
|
-
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/functions/wait.d.ts
|
|
128
166
|
declare function wait(seconds: number): Promise<void>;
|
|
129
|
-
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/functions/taggedTemplate/interpolate.d.ts
|
|
130
169
|
declare function interpolate(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
131
|
-
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/functions/taggedTemplate/interpolateObjects.d.ts
|
|
132
172
|
declare function interpolateObjects(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
133
|
-
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/functions/taggedTemplate/removeIndents.d.ts
|
|
134
175
|
interface RemoveIndentsOptions {
|
|
135
|
-
|
|
176
|
+
preserveTabs?: boolean;
|
|
136
177
|
}
|
|
137
178
|
type RemoveIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
138
179
|
declare function removeIndents(options: RemoveIndentsOptions): RemoveIndentsFunction;
|
|
139
180
|
declare function removeIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
whitespaceLength?: number;
|
|
143
|
-
preserveTabs?: boolean;
|
|
144
|
-
}
|
|
145
|
-
type StripIndentsFunction = (strings: TemplateStringsArray, ...interpolations: unknown[]) => string;
|
|
146
|
-
declare function stripIndents(options: StripIndentsOptions): StripIndentsFunction;
|
|
147
|
-
declare function stripIndents(strings: TemplateStringsArray, ...interpolations: unknown[]): string;
|
|
148
|
-
|
|
149
|
-
export { APIError, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, 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, parseZodSchema, 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 };
|