@alextheman/utility 2.21.0 → 3.1.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 CHANGED
@@ -1,745 +1,615 @@
1
- "use strict";
1
+ //#region rolldown:runtime
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
6
  var __getProtoOf = Object.getPrototypeOf;
8
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __export = (target, all) => {
23
- for (var name in all)
24
- __defProp(target, name, { get: all[name], enumerable: true });
25
- };
26
8
  var __copyProps = (to, from, except, desc) => {
27
- if (from && typeof from === "object" || typeof from === "function") {
28
- for (let key of __getOwnPropNames(from))
29
- if (!__hasOwnProp.call(to, key) && key !== except)
30
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31
- }
32
- return to;
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
33
21
  };
34
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
35
- // If the importer is in node compatibility mode or this is not an ESM
36
- // file that has been converted to a CommonJS file using a Babel-
37
- // compatible transform (i.e. "__esModule" has not been set), then set
38
- // "default" to the CommonJS "module.exports" for node compatibility.
39
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
40
- mod
41
- ));
42
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
44
-
45
- // src/index.ts
46
- var index_exports = {};
47
- __export(index_exports, {
48
- APIError: () => APIError_default,
49
- DataError: () => DataError_default,
50
- addDaysToDate: () => addDaysToDate_default,
51
- appendSemicolon: () => appendSemicolon_default,
52
- camelToKebab: () => camelToKebab_default,
53
- convertFileToBase64: () => convertFileToBase64_default,
54
- createFormData: () => createFormData_default,
55
- createTemplateStringsArray: () => createTemplateStringsArray_default,
56
- fillArray: () => fillArray_default,
57
- formatDateAndTime: () => formatDateAndTime_default,
58
- getRandomNumber: () => getRandomNumber_default,
59
- getRecordKeys: () => getRecordKeys_default,
60
- httpErrorCodeLookup: () => httpErrorCodeLookup,
61
- interpolate: () => interpolate_default,
62
- interpolateObjects: () => interpolateObjects_default,
63
- isLeapYear: () => isLeapYear_default,
64
- isMonthlyMultiple: () => isMonthlyMultiple_default,
65
- isOrdered: () => isOrdered_default,
66
- isSameDate: () => isSameDate_default,
67
- kebabToCamel: () => kebabToCamel_default,
68
- normaliseImportPath: () => normaliseImportPath,
69
- normalizeImportPath: () => normalizeImportPath_default,
70
- omitProperties: () => omitProperties_default,
71
- paralleliseArrays: () => paralleliseArrays_default,
72
- parseEmail: () => Email_default,
73
- parseEnv: () => Env_default,
74
- parseIntStrict: () => parseIntStrict_default,
75
- parseUUID: () => UUID_default,
76
- parseZodSchema: () => parseZodSchema_default,
77
- randomiseArray: () => randomiseArray_default,
78
- range: () => range_default,
79
- removeDuplicates: () => removeDuplicates_default,
80
- removeIndents: () => removeIndents_default,
81
- stringListToArray: () => stringListToArray_default,
82
- stringToBoolean: () => stringToBoolean_default,
83
- stripIndents: () => stripIndents_default,
84
- truncate: () => truncate_default,
85
- wait: () => wait_default
86
- });
87
- module.exports = __toCommonJS(index_exports);
88
-
89
- // src/functions/addDaysToDate.ts
90
- function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement = 1) {
91
- const newDate = currentDate;
92
- newDate.setDate(newDate.getDate() + dayIncrement);
93
- return newDate;
94
- }
95
- var addDaysToDate_default = addDaysToDate;
96
-
97
- // src/functions/appendSemicolon.ts
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+ let path = require("path");
29
+ path = __toESM(path);
30
+ let zod = require("zod");
31
+ zod = __toESM(zod);
32
+
33
+ //#region src/functions/appendSemicolon.ts
98
34
  function appendSemicolon(stringToAppendTo) {
99
- if (stringToAppendTo.includes("\n")) {
100
- throw new Error("MULTIPLE_LINE_ERROR");
101
- }
102
- const stringWithNoTrailingWhitespace = stringToAppendTo.trimEnd();
103
- if (stringWithNoTrailingWhitespace === "") {
104
- return "";
105
- }
106
- return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
35
+ if (stringToAppendTo.includes("\n")) throw new Error("MULTIPLE_LINE_ERROR");
36
+ const stringWithNoTrailingWhitespace = stringToAppendTo.trimEnd();
37
+ if (stringWithNoTrailingWhitespace === "") return "";
38
+ return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
107
39
  }
108
40
  var appendSemicolon_default = appendSemicolon;
109
41
 
110
- // src/functions/camelToKebab.ts
42
+ //#endregion
43
+ //#region src/functions/arrayHelpers/fillArray.ts
44
+ function fillArray(callback, length = 1) {
45
+ const outputArray = new Array(length).fill(null).map((_, index) => {
46
+ return callback(index);
47
+ });
48
+ if (outputArray.some((item) => {
49
+ return item instanceof Promise;
50
+ })) return Promise.all(outputArray);
51
+ return outputArray;
52
+ }
53
+ var fillArray_default = fillArray;
54
+
55
+ //#endregion
56
+ //#region src/functions/arrayHelpers/paralleliseArrays.ts
57
+ function paralleliseArrays(firstArray, secondArray) {
58
+ const outputArray = [];
59
+ for (let i = 0; i < firstArray.length; i++) outputArray.push([firstArray[i], secondArray[i]]);
60
+ return outputArray;
61
+ }
62
+ var paralleliseArrays_default = paralleliseArrays;
63
+
64
+ //#endregion
65
+ //#region src/functions/parsers/parseIntStrict.ts
66
+ const IntegerParsingError = /* @__PURE__ */ new TypeError("INTEGER_PARSING_ERROR");
67
+ function parseIntStrict(...[string, radix]) {
68
+ const trimmedString = string.trim();
69
+ if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${String.fromCharCode(87 + radix - 1)}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw IntegerParsingError;
70
+ if (radix && radix < 10 && [...trimmedString].some((character) => {
71
+ return parseInt(character) >= radix;
72
+ })) throw IntegerParsingError;
73
+ const parseIntResult = parseInt(trimmedString, radix);
74
+ if (isNaN(parseIntResult)) throw IntegerParsingError;
75
+ return parseIntResult;
76
+ }
77
+ var parseIntStrict_default = parseIntStrict;
78
+
79
+ //#endregion
80
+ //#region src/functions/getRandomNumber.ts
81
+ function getRandomNumber(lowerBound, upperBound) {
82
+ const parsedLowerBound = parseIntStrict_default(`${lowerBound}`);
83
+ const parsedUpperBound = parseIntStrict_default(`${upperBound}`);
84
+ return Math.floor(Math.random() * (parsedUpperBound - parsedLowerBound + 1) + parsedLowerBound);
85
+ }
86
+ var getRandomNumber_default = getRandomNumber;
87
+
88
+ //#endregion
89
+ //#region src/functions/arrayHelpers/randomiseArray.ts
90
+ function randomiseArray(array) {
91
+ const mutableArray = [...array];
92
+ const outputArray = [];
93
+ do {
94
+ const indexToRemove = getRandomNumber_default(0, mutableArray.length - 1);
95
+ outputArray.push(mutableArray.splice(indexToRemove, 1)[0]);
96
+ } while (mutableArray.length > 0);
97
+ return outputArray;
98
+ }
99
+ var randomiseArray_default = randomiseArray;
100
+
101
+ //#endregion
102
+ //#region src/functions/arrayHelpers/range.ts
103
+ function range(start, stop, step = 1) {
104
+ const numbers = [];
105
+ if (step === 0) throw new Error("ZERO_STEP_SIZE_NOT_ALLOWED");
106
+ else if (step > 0) {
107
+ if (start > stop) throw new Error("INVALID_BOUNDARIES");
108
+ for (let i = start; i < stop; i += step) numbers.push(i);
109
+ } else if (step < 0) {
110
+ if (start < stop) throw new Error("INVALID_BOUNDARIES");
111
+ for (let i = start; i > stop; i += step) numbers.push(i);
112
+ }
113
+ return numbers;
114
+ }
115
+ var range_default = range;
116
+
117
+ //#endregion
118
+ //#region src/functions/camelToKebab.ts
111
119
  function camelToKebab(string) {
112
- return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
120
+ return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
113
121
  }
114
122
  var camelToKebab_default = camelToKebab;
115
123
 
116
- // src/functions/convertFileToBase64.ts
124
+ //#endregion
125
+ //#region src/functions/convertFileToBase64.ts
117
126
  function convertFileToBase64(file) {
118
- return new Promise((resolve, reject) => {
119
- const reader = new FileReader();
120
- reader.readAsDataURL(file);
121
- reader.onload = () => {
122
- if (reader.result === null) {
123
- reject(new Error("FILE_CONVERSION_ERROR"));
124
- return;
125
- }
126
- resolve(reader.result);
127
- };
128
- reader.onerror = () => {
129
- reject(new Error("FILE_READER_ERROR"));
130
- };
131
- });
127
+ return new Promise((resolve, reject) => {
128
+ const reader = new FileReader();
129
+ reader.readAsDataURL(file);
130
+ reader.onload = () => {
131
+ if (reader.result === null) {
132
+ reject(/* @__PURE__ */ new Error("FILE_CONVERSION_ERROR"));
133
+ return;
134
+ }
135
+ resolve(reader.result);
136
+ };
137
+ reader.onerror = () => {
138
+ reject(/* @__PURE__ */ new Error("FILE_READER_ERROR"));
139
+ };
140
+ });
132
141
  }
133
142
  var convertFileToBase64_default = convertFileToBase64;
134
143
 
135
- // src/functions/createFormData.ts
144
+ //#endregion
145
+ //#region src/functions/createFormData.ts
136
146
  function getNullableResolutionStrategy(key, strategy) {
137
- var _a;
138
- return (_a = typeof strategy === "object" ? strategy[key] : strategy) != null ? _a : "empty";
147
+ return (typeof strategy === "object" ? strategy[key] : strategy) ?? "empty";
139
148
  }
140
149
  function createFormData(data, options = {
141
- arrayResolution: "stringify",
142
- nullableResolution: "empty"
150
+ arrayResolution: "stringify",
151
+ nullableResolution: "empty"
143
152
  }) {
144
- const formData = new FormData();
145
- function resolveNullablesByStrategy(key, value, resolutionStrategy) {
146
- switch (resolutionStrategy) {
147
- case "empty":
148
- formData.append(String(key), "");
149
- break;
150
- case "stringify":
151
- formData.append(String(key), JSON.stringify(value));
152
- break;
153
- case "omit":
154
- break;
155
- default:
156
- throw new TypeError("SLOPPY_PURE_JAVASCRIPT_USER_ERROR");
157
- }
158
- }
159
- function resolveNullables(key, value, options2) {
160
- if (options2.nullableResolution) {
161
- resolveNullablesByStrategy(
162
- key,
163
- value,
164
- getNullableResolutionStrategy(key, options2.nullableResolution)
165
- );
166
- return;
167
- }
168
- if (options2.undefinedResolution || options2.nullResolution) {
169
- if (data[key] === void 0 && options2.undefinedResolution) {
170
- resolveNullablesByStrategy(
171
- key,
172
- value,
173
- getNullableResolutionStrategy(key, options2.undefinedResolution)
174
- );
175
- return;
176
- }
177
- if (data[key] === null && options2.nullResolution) {
178
- resolveNullablesByStrategy(
179
- key,
180
- value,
181
- getNullableResolutionStrategy(key, options2.nullResolution)
182
- );
183
- }
184
- }
185
- }
186
- const entries = Object.entries(data);
187
- for (const [key, value] of entries) {
188
- if (value instanceof Blob) {
189
- formData.append(String(key), value);
190
- } else if (value === void 0 || value === null) {
191
- resolveNullables(key, value, options);
192
- } else if (typeof value === "object") {
193
- if (Array.isArray(value)) {
194
- if (value.some((item) => {
195
- return item instanceof Blob;
196
- }) && (options.arrayResolution === "stringify" || typeof options.arrayResolution === "object" && options.arrayResolution[key] === "stringify")) {
197
- throw new TypeError("CANNOT_STRINGIFY_BLOB");
198
- }
199
- if (options.arrayResolution === "multiple" || typeof options.arrayResolution === "object" && options.arrayResolution[key] === "multiple") {
200
- for (const item of value) {
201
- if ((typeof item === "object" || !item) && !(item instanceof Blob)) {
202
- throw new TypeError("NON_PRIMITIVE_ARRAY_ITEMS_FOUND");
203
- }
204
- if (item instanceof Blob) {
205
- formData.append(String(key), item);
206
- } else {
207
- formData.append(String(key), String(item));
208
- }
209
- }
210
- continue;
211
- }
212
- }
213
- formData.append(String(key), JSON.stringify(value));
214
- } else {
215
- formData.append(String(key), String(value));
216
- }
217
- }
218
- return formData;
153
+ const formData = new FormData();
154
+ function resolveNullablesByStrategy(key, value, resolutionStrategy) {
155
+ switch (resolutionStrategy) {
156
+ case "empty":
157
+ formData.append(String(key), "");
158
+ break;
159
+ case "stringify":
160
+ formData.append(String(key), JSON.stringify(value));
161
+ break;
162
+ case "omit": break;
163
+ default: throw new TypeError("SLOPPY_PURE_JAVASCRIPT_USER_ERROR");
164
+ }
165
+ }
166
+ function resolveNullables(key, value, options$1) {
167
+ if (options$1.nullableResolution) {
168
+ resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.nullableResolution));
169
+ return;
170
+ }
171
+ if (options$1.undefinedResolution || options$1.nullResolution) {
172
+ if (data[key] === void 0 && options$1.undefinedResolution) {
173
+ resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.undefinedResolution));
174
+ return;
175
+ }
176
+ if (data[key] === null && options$1.nullResolution) resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.nullResolution));
177
+ }
178
+ }
179
+ const entries = Object.entries(data);
180
+ for (const [key, value] of entries) if (value instanceof Blob) formData.append(String(key), value);
181
+ else if (value === void 0 || value === null) resolveNullables(key, value, options);
182
+ else if (typeof value === "object") {
183
+ if (Array.isArray(value)) {
184
+ if (value.some((item) => {
185
+ return item instanceof Blob;
186
+ }) && (options.arrayResolution === "stringify" || typeof options.arrayResolution === "object" && options.arrayResolution[key] === "stringify")) throw new TypeError("CANNOT_STRINGIFY_BLOB");
187
+ if (options.arrayResolution === "multiple" || typeof options.arrayResolution === "object" && options.arrayResolution[key] === "multiple") {
188
+ for (const item of value) {
189
+ if ((typeof item === "object" || !item) && !(item instanceof Blob)) throw new TypeError("NON_PRIMITIVE_ARRAY_ITEMS_FOUND");
190
+ if (item instanceof Blob) formData.append(String(key), item);
191
+ else formData.append(String(key), String(item));
192
+ }
193
+ continue;
194
+ }
195
+ }
196
+ formData.append(String(key), JSON.stringify(value));
197
+ } else formData.append(String(key), String(value));
198
+ return formData;
219
199
  }
220
200
  var createFormData_default = createFormData;
221
201
 
222
- // src/functions/createTemplateStringsArray.ts
202
+ //#endregion
203
+ //#region src/functions/createTemplateStringsArray.ts
223
204
  function createTemplateStringsArray(strings) {
224
- return Object.assign([...strings], { raw: [...strings] });
205
+ return Object.assign([...strings], { raw: [...strings] });
225
206
  }
226
207
  var createTemplateStringsArray_default = createTemplateStringsArray;
227
208
 
228
- // src/functions/fillArray.ts
229
- function fillArray(callback, length = 1) {
230
- const outputArray = new Array(length).fill(null).map((_, index) => {
231
- return callback(index);
232
- });
233
- const isAsync = outputArray.some((item) => {
234
- return item instanceof Promise;
235
- });
236
- if (isAsync) {
237
- return Promise.all(outputArray);
238
- }
239
- return outputArray;
209
+ //#endregion
210
+ //#region src/functions/date/addDaysToDate.ts
211
+ function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement = 1) {
212
+ const newDate = currentDate;
213
+ newDate.setDate(newDate.getDate() + dayIncrement);
214
+ return newDate;
240
215
  }
241
- var fillArray_default = fillArray;
216
+ var addDaysToDate_default = addDaysToDate;
242
217
 
243
- // src/functions/isSameDate.ts
218
+ //#endregion
219
+ //#region src/functions/date/isSameDate.ts
244
220
  function isSameDate(firstDate, secondDate) {
245
- return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth() && firstDate.getFullYear() === secondDate.getFullYear();
221
+ return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth() && firstDate.getFullYear() === secondDate.getFullYear();
246
222
  }
247
223
  var isSameDate_default = isSameDate;
248
224
 
249
- // src/functions/formatDateAndTime.ts
225
+ //#endregion
226
+ //#region src/functions/date/formatDateAndTime.ts
250
227
  function formatDateAndTime(inputDate) {
251
- const yesterday = addDaysToDate_default(/* @__PURE__ */ new Date(), -1);
252
- const today = /* @__PURE__ */ new Date();
253
- const inputTime = `${inputDate.getHours().toString().padStart(2, "0")}:${inputDate.getMinutes().toString().padStart(2, "0")}`;
254
- if (isSameDate_default(inputDate, yesterday)) {
255
- return `Yesterday at ${inputTime}`;
256
- }
257
- if (isSameDate_default(inputDate, today)) {
258
- return `Today at ${inputTime}`;
259
- }
260
- const formattedInputDay = inputDate.getDate().toString().padStart(2, "0");
261
- const formattedInputMonth = (inputDate.getMonth() + 1).toString().padStart(2, "0");
262
- const formattedInputYear = inputDate.getFullYear().toString();
263
- return `${formattedInputDay}/${formattedInputMonth}/${formattedInputYear}, ${inputTime}`;
228
+ const yesterday = addDaysToDate_default(/* @__PURE__ */ new Date(), -1);
229
+ const today = /* @__PURE__ */ new Date();
230
+ const inputTime = `${inputDate.getHours().toString().padStart(2, "0")}:${inputDate.getMinutes().toString().padStart(2, "0")}`;
231
+ if (isSameDate_default(inputDate, yesterday)) return `Yesterday at ${inputTime}`;
232
+ if (isSameDate_default(inputDate, today)) return `Today at ${inputTime}`;
233
+ return `${inputDate.getDate().toString().padStart(2, "0")}/${(inputDate.getMonth() + 1).toString().padStart(2, "0")}/${inputDate.getFullYear().toString()}, ${inputTime}`;
264
234
  }
265
235
  var formatDateAndTime_default = formatDateAndTime;
266
236
 
267
- // src/functions/parseIntStrict.ts
268
- var IntegerParsingError = new TypeError("INTEGER_PARSING_ERROR");
269
- function parseIntStrict(...[string, radix]) {
270
- const trimmedString = string.trim();
271
- const pattern = radix && radix > 10 && radix <= 36 ? (
272
- // String.fromCharCode() gets the maximum possible alphabetical character for a base above 10
273
- new RegExp(`^[+-]?[0-9a-${String.fromCharCode(87 + radix - 1)}]+$`, "i")
274
- ) : /^[+-]?\d+$/;
275
- if (!pattern.test(trimmedString)) {
276
- throw IntegerParsingError;
277
- }
278
- if (radix && radix < 10 && [...trimmedString].some((character) => {
279
- return parseInt(character) >= radix;
280
- })) {
281
- throw IntegerParsingError;
282
- }
283
- const parseIntResult = parseInt(trimmedString, radix);
284
- if (isNaN(parseIntResult)) {
285
- throw IntegerParsingError;
286
- }
287
- return parseIntResult;
288
- }
289
- var parseIntStrict_default = parseIntStrict;
290
-
291
- // src/functions/getRandomNumber.ts
292
- function getRandomNumber(lowerBound, upperBound) {
293
- const parsedLowerBound = parseIntStrict_default(`${lowerBound}`);
294
- const parsedUpperBound = parseIntStrict_default(`${upperBound}`);
295
- return Math.floor(Math.random() * (parsedUpperBound - parsedLowerBound + 1) + parsedLowerBound);
237
+ //#endregion
238
+ //#region src/functions/date/isLeapYear.ts
239
+ function isLeapYear(year) {
240
+ const parsedYear = parseIntStrict_default(`${year}`);
241
+ return parsedYear % 4 === 0 && parsedYear % 100 !== 0 || parsedYear % 400 === 0;
296
242
  }
297
- var getRandomNumber_default = getRandomNumber;
243
+ var isLeapYear_default = isLeapYear;
298
244
 
299
- // src/functions/getRecordKeys.ts
300
- function getRecordKeys(record) {
301
- return Object.keys(record);
245
+ //#endregion
246
+ //#region src/functions/date/isAnniversary.ts
247
+ function checkLeapYear(firstDate, secondDate) {
248
+ if (isLeapYear_default(firstDate.getFullYear()) && firstDate.getMonth() === 1 && secondDate.getMonth() === 1) return firstDate.getDate() === 29 && secondDate.getDate() === 28;
249
+ return false;
302
250
  }
303
- var getRecordKeys_default = getRecordKeys;
304
-
305
- // src/functions/isLeapYear.ts
306
- function isLeapYear(year) {
307
- const parsedYear = parseIntStrict_default(`${year}`);
308
- return parsedYear % 4 === 0 && parsedYear % 100 !== 0 || parsedYear % 400 === 0;
251
+ function isAnniversary(firstDate, secondDate) {
252
+ if (checkLeapYear(firstDate, secondDate) || checkLeapYear(secondDate, firstDate)) return true;
253
+ return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth();
309
254
  }
310
- var isLeapYear_default = isLeapYear;
255
+ var isAnniversary_default = isAnniversary;
311
256
 
312
- // src/functions/isMonthlyMultiple.ts
257
+ //#endregion
258
+ //#region src/functions/date/isMonthlyMultiple.ts
313
259
  function endOfMonthChecksButNotFebruary(firstDate, secondDate) {
314
- if ([3, 5, 8, 10].includes(firstDate.getMonth())) {
315
- return firstDate.getDate() === 30 && secondDate.getDate() === 31;
316
- }
317
- return false;
260
+ if ([
261
+ 3,
262
+ 5,
263
+ 8,
264
+ 10
265
+ ].includes(firstDate.getMonth())) return firstDate.getDate() === 30 && secondDate.getDate() === 31;
266
+ return false;
318
267
  }
319
268
  function nonLeapYearFebruaryChecks(firstDate, secondDate) {
320
- if (firstDate.getMonth() === 1) {
321
- if (!isLeapYear_default(firstDate.getFullYear()) && firstDate.getDate() === 28) {
322
- return [28, 29, 30, 31].includes(secondDate.getDate());
323
- }
324
- }
325
- return false;
269
+ if (firstDate.getMonth() === 1) {
270
+ if (!isLeapYear_default(firstDate.getFullYear()) && firstDate.getDate() === 28) return [
271
+ 28,
272
+ 29,
273
+ 30,
274
+ 31
275
+ ].includes(secondDate.getDate());
276
+ }
277
+ return false;
326
278
  }
327
279
  function leapYearFebruaryChecks(firstDate, secondDate) {
328
- if (firstDate.getMonth() === 1) {
329
- if (isLeapYear_default(firstDate.getFullYear()) && firstDate.getDate() === 29) {
330
- return [29, 30, 31].includes(secondDate.getDate());
331
- }
332
- }
333
- return false;
280
+ if (firstDate.getMonth() === 1) {
281
+ if (isLeapYear_default(firstDate.getFullYear()) && firstDate.getDate() === 29) return [
282
+ 29,
283
+ 30,
284
+ 31
285
+ ].includes(secondDate.getDate());
286
+ }
287
+ return false;
334
288
  }
335
289
  function isMonthlyMultiple(firstDate, secondDate) {
336
- if (endOfMonthChecksButNotFebruary(firstDate, secondDate) || endOfMonthChecksButNotFebruary(secondDate, firstDate)) {
337
- return true;
338
- }
339
- if (nonLeapYearFebruaryChecks(firstDate, secondDate) || nonLeapYearFebruaryChecks(secondDate, firstDate)) {
340
- return true;
341
- }
342
- if (leapYearFebruaryChecks(firstDate, secondDate) || leapYearFebruaryChecks(secondDate, firstDate)) {
343
- return true;
344
- }
345
- return firstDate.getDate() === secondDate.getDate();
290
+ if (endOfMonthChecksButNotFebruary(firstDate, secondDate) || endOfMonthChecksButNotFebruary(secondDate, firstDate)) return true;
291
+ if (nonLeapYearFebruaryChecks(firstDate, secondDate) || nonLeapYearFebruaryChecks(secondDate, firstDate)) return true;
292
+ if (leapYearFebruaryChecks(firstDate, secondDate) || leapYearFebruaryChecks(secondDate, firstDate)) return true;
293
+ return firstDate.getDate() === secondDate.getDate();
346
294
  }
347
295
  var isMonthlyMultiple_default = isMonthlyMultiple;
348
296
 
349
- // src/functions/isOrdered.ts
297
+ //#endregion
298
+ //#region src/functions/getRecordKeys.ts
299
+ function getRecordKeys(record) {
300
+ return Object.keys(record);
301
+ }
302
+ var getRecordKeys_default = getRecordKeys;
303
+
304
+ //#endregion
305
+ //#region src/functions/isOrdered.ts
350
306
  function isOrdered(array) {
351
- const newArray = [...array];
352
- newArray.sort();
353
- for (const index in newArray) {
354
- if (newArray[index] !== array[index]) {
355
- return false;
356
- }
357
- }
358
- return true;
307
+ const newArray = [...array];
308
+ newArray.sort();
309
+ for (const index in newArray) if (newArray[index] !== array[index]) return false;
310
+ return true;
359
311
  }
360
312
  var isOrdered_default = isOrdered;
361
313
 
362
- // src/functions/kebabToCamel.ts
314
+ //#endregion
315
+ //#region src/functions/kebabToCamel.ts
363
316
  function kebabToCamel(string, options) {
364
- if (string !== string.toLowerCase()) {
365
- throw new Error("INVALID_KEBAB_CASE_INPUT");
366
- }
367
- if (string.startsWith("-") || string.endsWith("-") || string.includes("--")) {
368
- throw new Error("INVALID_KEBAB_CASE_INPUT");
369
- }
370
- let outputString = "";
371
- let skip = false;
372
- for (const stringIndex in [...string]) {
373
- if (skip) {
374
- skip = false;
375
- continue;
376
- }
377
- const index = parseIntStrict_default(stringIndex);
378
- if (index === 0 && (options == null ? void 0 : options.startWithUpper)) {
379
- outputString += string[index].toUpperCase();
380
- continue;
381
- }
382
- if (index === string.length - 1) {
383
- outputString += string[index];
384
- break;
385
- }
386
- if (string[index] === "-" && /^[a-zA-Z]+$/.test(string[index + 1])) {
387
- outputString += string[index + 1].toUpperCase();
388
- skip = true;
389
- } else {
390
- outputString += string[index];
391
- }
392
- }
393
- return outputString;
317
+ if (string !== string.toLowerCase()) throw new Error("INVALID_KEBAB_CASE_INPUT");
318
+ if (string.startsWith("-") || string.endsWith("-") || string.includes("--")) throw new Error("INVALID_KEBAB_CASE_INPUT");
319
+ let outputString = "";
320
+ let skip = false;
321
+ for (const stringIndex in [...string]) {
322
+ if (skip) {
323
+ skip = false;
324
+ continue;
325
+ }
326
+ const index = parseIntStrict_default(stringIndex);
327
+ if (index === 0 && options?.startWithUpper) {
328
+ outputString += string[index].toUpperCase();
329
+ continue;
330
+ }
331
+ if (index === string.length - 1) {
332
+ outputString += string[index];
333
+ break;
334
+ }
335
+ if (string[index] === "-" && /^[a-zA-Z]+$/.test(string[index + 1])) {
336
+ outputString += string[index + 1].toUpperCase();
337
+ skip = true;
338
+ } else outputString += string[index];
339
+ }
340
+ return outputString;
394
341
  }
395
342
  var kebabToCamel_default = kebabToCamel;
396
343
 
397
- // src/functions/normalizeImportPath.ts
398
- var import_path = __toESM(require("path"), 1);
344
+ //#endregion
345
+ //#region src/functions/normalizeImportPath.ts
399
346
  function normalizeImportPath(importPath) {
400
- const normalizedPath = import_path.default.posix.normalize(importPath);
401
- if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
402
- return `./${normalizedPath}`;
403
- }
404
- return normalizedPath;
347
+ const normalizedPath = path.default.posix.normalize(importPath);
348
+ if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) return `./${normalizedPath}`;
349
+ return normalizedPath;
405
350
  }
406
- var normaliseImportPath = normalizeImportPath;
351
+ const normaliseImportPath = normalizeImportPath;
407
352
  var normalizeImportPath_default = normalizeImportPath;
408
353
 
409
- // src/functions/omitProperties.ts
354
+ //#endregion
355
+ //#region src/functions/omitProperties.ts
410
356
  function omitProperties(object, keysToOmit) {
411
- const outputObject = __spreadValues({}, object);
412
- const keysArray = Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit];
413
- keysArray.forEach((key) => {
414
- delete outputObject[key];
415
- });
416
- return outputObject;
357
+ const outputObject = { ...object };
358
+ (Array.isArray(keysToOmit) ? keysToOmit : [keysToOmit]).forEach((key) => {
359
+ delete outputObject[key];
360
+ });
361
+ return outputObject;
417
362
  }
418
363
  var omitProperties_default = omitProperties;
419
364
 
420
- // src/functions/paralleliseArrays.ts
421
- function paralleliseArrays(firstArray, secondArray) {
422
- const outputArray = [];
423
- for (let i = 0; i < firstArray.length; i++) {
424
- outputArray.push([firstArray[i], secondArray[i]]);
425
- }
426
- return outputArray;
427
- }
428
- var paralleliseArrays_default = paralleliseArrays;
429
-
430
- // src/types/APIError.ts
431
- var httpErrorCodeLookup = {
432
- 400: "BAD_REQUEST",
433
- 401: "UNAUTHORISED",
434
- 403: "FORBIDDEN",
435
- 404: "NOT_FOUND",
436
- /* Supporting this one too because it's funny. You'll never use it in practice because
437
- why would an error give a teapot, but it's funny. Do not question me. */
438
- 418: "I_AM_A_TEAPOT",
439
- 500: "INTERNAL_SERVER_ERROR"
365
+ //#endregion
366
+ //#region src/functions/parsers/parseBoolean.ts
367
+ function parseBoolean(inputString) {
368
+ const normalisedString = inputString.toLowerCase();
369
+ if (normalisedString !== "true" && normalisedString !== "false") throw new TypeError("INVALID_BOOLEAN_STRING");
370
+ return normalisedString === "true";
371
+ }
372
+ /** @deprecated This function has been renamed to parseBoolean. */
373
+ const stringToBoolean = parseBoolean;
374
+ var parseBoolean_default = parseBoolean;
375
+
376
+ //#endregion
377
+ //#region src/functions/parsers/parseFormData.ts
378
+ function parseFormData(formData, dataParser) {
379
+ const object = {};
380
+ formData.forEach((value, key) => {
381
+ object[key] = value;
382
+ });
383
+ if (dataParser) return dataParser(object);
384
+ return object;
385
+ }
386
+ var parseFormData_default = parseFormData;
387
+
388
+ //#endregion
389
+ //#region src/types/APIError.ts
390
+ const httpErrorCodeLookup = {
391
+ 400: "BAD_REQUEST",
392
+ 401: "UNAUTHORISED",
393
+ 403: "FORBIDDEN",
394
+ 404: "NOT_FOUND",
395
+ 418: "I_AM_A_TEAPOT",
396
+ 500: "INTERNAL_SERVER_ERROR"
440
397
  };
441
398
  var APIError = class extends Error {
442
- constructor(status = 500, message, options) {
443
- var _a;
444
- super(message, options);
445
- __publicField(this, "status");
446
- this.status = status;
447
- if (message) {
448
- this.message = message;
449
- } else {
450
- this.message = (_a = httpErrorCodeLookup[this.status]) != null ? _a : "API_ERROR";
451
- }
452
- Object.defineProperty(this, "message", { enumerable: true });
453
- Object.setPrototypeOf(this, new.target.prototype);
454
- }
455
- static check(input) {
456
- const data = input;
457
- return typeof data === "object" && data !== null && typeof (data == null ? void 0 : data.status) === "number" && typeof (data == null ? void 0 : data.message) === "string";
458
- }
399
+ status;
400
+ constructor(status = 500, message, options) {
401
+ super(message, options);
402
+ this.status = status;
403
+ if (message) this.message = message;
404
+ else this.message = httpErrorCodeLookup[this.status] ?? "API_ERROR";
405
+ Object.defineProperty(this, "message", { enumerable: true });
406
+ Object.setPrototypeOf(this, new.target.prototype);
407
+ }
408
+ static check(input) {
409
+ const data = input;
410
+ return typeof data === "object" && data !== null && typeof data?.status === "number" && typeof data?.message === "string";
411
+ }
459
412
  };
460
413
  var APIError_default = APIError;
461
414
 
462
- // src/types/DataError.ts
415
+ //#endregion
416
+ //#region src/types/DataError.ts
463
417
  var DataError = class extends Error {
464
- /** @param data - The data that caused the error. */
465
- /** @param message - A human-readable error message (e.g. The data provided is invalid). */
466
- /** @param code - A standardised code (e.g. UNEXPECTED_DATA). */
467
- /** @param options - Extra options to pass to super Error constructor. */
468
- constructor(data, message = "The data provided is invalid", code = "INVALID_DATA", options) {
469
- super(message, options);
470
- __publicField(this, "data");
471
- __publicField(this, "code");
472
- if (Error.captureStackTrace) {
473
- Error.captureStackTrace(this, new.target);
474
- }
475
- this.name = new.target.name;
476
- this.code = code;
477
- this.data = data;
478
- Object.defineProperty(this, "message", { enumerable: true });
479
- Object.setPrototypeOf(this, new.target.prototype);
480
- }
481
- static check(input) {
482
- const data = input;
483
- return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
484
- }
418
+ data;
419
+ code;
420
+ /** @param data - The data that caused the error. */
421
+ /** @param message - A human-readable error message (e.g. The data provided is invalid). */
422
+ /** @param code - A standardised code (e.g. UNEXPECTED_DATA). */
423
+ /** @param options - Extra options to pass to super Error constructor. */
424
+ constructor(data, message = "The data provided is invalid", code = "INVALID_DATA", options) {
425
+ super(message, options);
426
+ if (Error.captureStackTrace) Error.captureStackTrace(this, new.target);
427
+ this.name = new.target.name;
428
+ this.code = code;
429
+ this.data = data;
430
+ Object.defineProperty(this, "message", { enumerable: true });
431
+ Object.setPrototypeOf(this, new.target.prototype);
432
+ }
433
+ static check(input) {
434
+ const data = input;
435
+ return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
436
+ }
485
437
  };
486
438
  var DataError_default = DataError;
487
439
 
488
- // src/types/Email.ts
489
- var import_zod = __toESM(require("zod"), 1);
490
- var emailSchema = import_zod.default.email().brand();
440
+ //#endregion
441
+ //#region src/types/Email.ts
442
+ const emailSchema = zod.default.email().brand();
491
443
  function parseEmail(data) {
492
- return emailSchema.parse(data);
444
+ return emailSchema.parse(data);
493
445
  }
494
446
  var Email_default = parseEmail;
495
447
 
496
- // src/types/Env.ts
497
- var import_zod2 = require("zod");
498
- var envSchema = import_zod2.z.enum(["test", "development", "production"]);
448
+ //#endregion
449
+ //#region src/types/Env.ts
450
+ const envSchema = zod.z.enum([
451
+ "test",
452
+ "development",
453
+ "production"
454
+ ]);
499
455
  function parseEnv(data = "development") {
500
- return envSchema.parse(data);
456
+ return envSchema.parse(data);
501
457
  }
502
458
  var Env_default = parseEnv;
503
459
 
504
- // src/types/UUID.ts
505
- var import_zod3 = __toESM(require("zod"), 1);
506
- var uuidSchema = import_zod3.default.uuid().brand();
460
+ //#endregion
461
+ //#region src/types/UUID.ts
462
+ const uuidSchema = zod.default.uuid().brand();
507
463
  function parseUUID(UUID) {
508
- return uuidSchema.parse(UUID);
464
+ return uuidSchema.parse(UUID);
509
465
  }
510
466
  var UUID_default = parseUUID;
511
467
 
512
- // src/functions/parseZodSchema.ts
468
+ //#endregion
469
+ //#region src/functions/parsers/parseZodSchema.ts
513
470
  function parseZodSchema(schema, data) {
514
- const parsedResult = schema.safeParse(data);
515
- if (!parsedResult.success) {
516
- throw new DataError_default(data);
517
- }
518
- return parsedResult.data;
471
+ const parsedResult = schema.safeParse(data);
472
+ if (!parsedResult.success) throw new DataError_default(data);
473
+ return parsedResult.data;
519
474
  }
520
475
  var parseZodSchema_default = parseZodSchema;
521
476
 
522
- // src/functions/randomiseArray.ts
523
- function randomiseArray(array) {
524
- const mutableArray = [...array];
525
- const outputArray = [];
526
- do {
527
- const indexToRemove = getRandomNumber_default(0, mutableArray.length - 1);
528
- outputArray.push(mutableArray.splice(indexToRemove, 1)[0]);
529
- } while (mutableArray.length > 0);
530
- return outputArray;
531
- }
532
- var randomiseArray_default = randomiseArray;
533
-
534
- // src/functions/range.ts
535
- function range(start, stop, step = 1) {
536
- const numbers = [];
537
- if (step === 0) {
538
- throw new Error("ZERO_STEP_SIZE_NOT_ALLOWED");
539
- } else if (step > 0) {
540
- if (start > stop) {
541
- throw new Error("INVALID_BOUNDARIES");
542
- }
543
- for (let i = start; i < stop; i += step) {
544
- numbers.push(i);
545
- }
546
- } else if (step < 0) {
547
- if (start < stop) {
548
- throw new Error("INVALID_BOUNDARIES");
549
- }
550
- for (let i = start; i > stop; i += step) {
551
- numbers.push(i);
552
- }
553
- }
554
- return numbers;
555
- }
556
- var range_default = range;
557
-
558
- // src/functions/removeDuplicates.ts
477
+ //#endregion
478
+ //#region src/functions/removeDuplicates.ts
559
479
  function removeDuplicates(array) {
560
- const outputArray = [];
561
- for (const item of array) {
562
- if (!outputArray.includes(item)) {
563
- outputArray.push(item);
564
- }
565
- }
566
- return outputArray;
480
+ const outputArray = [];
481
+ for (const item of array) if (!outputArray.includes(item)) outputArray.push(item);
482
+ return outputArray;
567
483
  }
568
484
  var removeDuplicates_default = removeDuplicates;
569
485
 
570
- // src/functions/stringListToArray.ts
486
+ //#endregion
487
+ //#region src/functions/stringListToArray.ts
571
488
  function stringListToArray(stringList, { separator = ",", trimWhitespace = true } = {}) {
572
- if (trimWhitespace && stringList.trim() === "") {
573
- return [];
574
- }
575
- const arrayList = stringList.split(separator != null ? separator : "");
576
- return trimWhitespace ? arrayList.map((item) => {
577
- return item.trim();
578
- }) : arrayList;
489
+ if (trimWhitespace && stringList.trim() === "") return [];
490
+ const arrayList = stringList.split(separator ?? "");
491
+ return trimWhitespace ? arrayList.map((item) => {
492
+ return item.trim();
493
+ }) : arrayList;
579
494
  }
580
495
  var stringListToArray_default = stringListToArray;
581
496
 
582
- // src/functions/stringToBoolean.ts
583
- function stringToBoolean(inputString) {
584
- const normalisedString = inputString.toLowerCase();
585
- if (normalisedString !== "true" && normalisedString !== "false") {
586
- throw new TypeError("INVALID_BOOLEAN_STRING");
587
- }
588
- return normalisedString === "true";
589
- }
590
- var stringToBoolean_default = stringToBoolean;
591
-
592
- // src/functions/truncate.ts
593
- function truncate(stringToTruncate, maxLength = 5) {
594
- return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
595
- }
596
- var truncate_default = truncate;
597
-
598
- // src/functions/wait.ts
599
- function wait(seconds) {
600
- return new Promise((resolve, _) => {
601
- setTimeout(() => {
602
- resolve();
603
- }, seconds * 1e3);
604
- });
605
- }
606
- var wait_default = wait;
607
-
608
- // src/functions/taggedTemplate/interpolate.ts
497
+ //#endregion
498
+ //#region src/functions/taggedTemplate/interpolate.ts
609
499
  function interpolate(strings, ...interpolations) {
610
- let result = "";
611
- for (const [string, interpolation = ""] of paralleliseArrays_default(strings, interpolations)) {
612
- result += string + interpolation;
613
- }
614
- return result;
500
+ let result = "";
501
+ for (const [string, interpolation = ""] of paralleliseArrays_default(strings, interpolations)) result += string + interpolation;
502
+ return result;
615
503
  }
616
504
  var interpolate_default = interpolate;
617
505
 
618
- // src/functions/taggedTemplate/interpolateObjects.ts
506
+ //#endregion
507
+ //#region src/functions/taggedTemplate/interpolateObjects.ts
619
508
  function interpolateObjects(strings, ...values) {
620
- let result = "";
621
- for (let i = 0; i < strings.length; i++) {
622
- result += strings[i];
623
- if (i !== strings.length - 1) {
624
- result += values[i] && typeof values[i] === "object" ? JSON.stringify(values[i]) : values[i];
625
- }
626
- }
627
- return result;
509
+ let result = "";
510
+ for (let i = 0; i < strings.length; i++) {
511
+ result += strings[i];
512
+ if (i !== strings.length - 1) result += values[i] && typeof values[i] === "object" ? JSON.stringify(values[i]) : values[i];
513
+ }
514
+ return result;
628
515
  }
629
516
  var interpolateObjects_default = interpolateObjects;
630
517
 
631
- // src/functions/taggedTemplate/removeIndents.ts
518
+ //#endregion
519
+ //#region src/functions/taggedTemplate/removeIndents.ts
632
520
  function calculateTabSize(line, whitespaceLength) {
633
- const potentialWhitespacePart = line.slice(0, whitespaceLength);
634
- const trimmedString = line.trimStart();
635
- if (potentialWhitespacePart.trim() !== "") {
636
- return 0;
637
- }
638
- const tabSize = line.length - (trimmedString.length + whitespaceLength);
639
- return tabSize < 0 ? 0 : tabSize;
521
+ const potentialWhitespacePart = line.slice(0, whitespaceLength);
522
+ const trimmedString = line.trimStart();
523
+ if (potentialWhitespacePart.trim() !== "") return 0;
524
+ const tabSize = line.length - (trimmedString.length + whitespaceLength);
525
+ return tabSize < 0 ? 0 : tabSize;
640
526
  }
641
527
  function getWhitespaceLength(lines) {
642
- const [firstNonEmptyLine] = lines.filter((line) => {
643
- return line.trim() !== "";
644
- });
645
- return firstNonEmptyLine.length - firstNonEmptyLine.trimStart().length;
528
+ const [firstNonEmptyLine] = lines.filter((line) => {
529
+ return line.trim() !== "";
530
+ });
531
+ return firstNonEmptyLine.length - firstNonEmptyLine.trimStart().length;
646
532
  }
647
533
  function reduceLines(lines, { preserveTabs = true }) {
648
- const slicedLines = lines.slice(1);
649
- const isFirstLineEmpty = lines[0].trim() === "";
650
- const whitespaceLength = getWhitespaceLength(isFirstLineEmpty ? lines : slicedLines);
651
- return (isFirstLineEmpty ? slicedLines : lines).map((line) => {
652
- const tabSize = calculateTabSize(line, whitespaceLength);
653
- return (preserveTabs ? fillArray_default(() => {
654
- return " ";
655
- }, tabSize).join("") : "") + line.trimStart();
656
- }).join("\n");
534
+ const slicedLines = lines.slice(1);
535
+ const isFirstLineEmpty = lines[0].trim() === "";
536
+ const whitespaceLength = getWhitespaceLength(isFirstLineEmpty ? lines : slicedLines);
537
+ return (isFirstLineEmpty ? slicedLines : lines).map((line) => {
538
+ const tabSize = calculateTabSize(line, whitespaceLength);
539
+ return (preserveTabs ? fillArray_default(() => {
540
+ return " ";
541
+ }, tabSize).join("") : "") + line.trimStart();
542
+ }).join("\n");
657
543
  }
658
544
  function removeIndents(first, ...args) {
659
- if (typeof first === "object" && first !== null && !Array.isArray(first)) {
660
- const options2 = first;
661
- return (strings2, ...interpolations2) => {
662
- return removeIndents(strings2, ...interpolations2, options2);
663
- };
664
- }
665
- const strings = first;
666
- const options = typeof args[args.length - 1] === "object" && !Array.isArray(args[args.length - 1]) ? args.pop() : {};
667
- const interpolations = [...args];
668
- const fullString = interpolate_default(strings, ...interpolations);
669
- return reduceLines(fullString.split("\n"), options);
545
+ if (typeof first === "object" && first !== null && !Array.isArray(first)) {
546
+ const options$1 = first;
547
+ return (strings$1, ...interpolations) => {
548
+ return removeIndents(strings$1, ...interpolations, options$1);
549
+ };
550
+ }
551
+ const strings = first;
552
+ const options = typeof args[args.length - 1] === "object" && !Array.isArray(args[args.length - 1]) ? args.pop() : {};
553
+ return reduceLines(interpolate_default(strings, ...[...args]).split("\n"), options);
670
554
  }
671
555
  var removeIndents_default = removeIndents;
672
556
 
673
- // src/functions/taggedTemplate/stripIndents.ts
674
- function calculateTabSize2(line, whitespaceLength = 12) {
675
- const potentialWhitespacePart = line.slice(0, whitespaceLength);
676
- const trimmedString = line.trimStart();
677
- if (potentialWhitespacePart.trim() !== "") {
678
- return 0;
679
- }
680
- const tabSize = line.length - (trimmedString.length + whitespaceLength);
681
- return tabSize < 0 ? 0 : tabSize;
682
- }
683
- function reduceLines2(lines, { whitespaceLength = 12, preserveTabs = true }) {
684
- return lines.map((line) => {
685
- const tabSize = calculateTabSize2(line, whitespaceLength);
686
- return (preserveTabs ? fillArray_default(() => {
687
- return " ";
688
- }, tabSize).join("") : "") + line.trimStart();
689
- }).join("\n");
690
- }
691
- function stripIndents(first, ...args) {
692
- if (typeof first === "object" && first !== null && !Array.isArray(first)) {
693
- const options2 = first;
694
- return (strings2, ...interpolations2) => {
695
- return stripIndents(strings2, ...interpolations2, options2);
696
- };
697
- }
698
- const strings = first;
699
- const options = typeof args[args.length - 1] === "object" && !Array.isArray(args[args.length - 1]) ? args.pop() : {};
700
- const interpolations = [...args];
701
- const fullString = interpolate_default(strings, ...interpolations);
702
- return reduceLines2(fullString.split("\n"), options);
703
- }
704
- var stripIndents_default = stripIndents;
705
- // Annotate the CommonJS export names for ESM import in node:
706
- 0 && (module.exports = {
707
- APIError,
708
- DataError,
709
- addDaysToDate,
710
- appendSemicolon,
711
- camelToKebab,
712
- convertFileToBase64,
713
- createFormData,
714
- createTemplateStringsArray,
715
- fillArray,
716
- formatDateAndTime,
717
- getRandomNumber,
718
- getRecordKeys,
719
- httpErrorCodeLookup,
720
- interpolate,
721
- interpolateObjects,
722
- isLeapYear,
723
- isMonthlyMultiple,
724
- isOrdered,
725
- isSameDate,
726
- kebabToCamel,
727
- normaliseImportPath,
728
- normalizeImportPath,
729
- omitProperties,
730
- paralleliseArrays,
731
- parseEmail,
732
- parseEnv,
733
- parseIntStrict,
734
- parseUUID,
735
- parseZodSchema,
736
- randomiseArray,
737
- range,
738
- removeDuplicates,
739
- removeIndents,
740
- stringListToArray,
741
- stringToBoolean,
742
- stripIndents,
743
- truncate,
744
- wait
745
- });
557
+ //#endregion
558
+ //#region src/functions/truncate.ts
559
+ function truncate(stringToTruncate, maxLength = 5) {
560
+ return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
561
+ }
562
+ var truncate_default = truncate;
563
+
564
+ //#endregion
565
+ //#region src/functions/wait.ts
566
+ function wait(seconds) {
567
+ return new Promise((resolve, _) => {
568
+ setTimeout(() => {
569
+ resolve();
570
+ }, seconds * 1e3);
571
+ });
572
+ }
573
+ var wait_default = wait;
574
+
575
+ //#endregion
576
+ exports.APIError = APIError_default;
577
+ exports.DataError = DataError_default;
578
+ exports.addDaysToDate = addDaysToDate_default;
579
+ exports.appendSemicolon = appendSemicolon_default;
580
+ exports.camelToKebab = camelToKebab_default;
581
+ exports.convertFileToBase64 = convertFileToBase64_default;
582
+ exports.createFormData = createFormData_default;
583
+ exports.createTemplateStringsArray = createTemplateStringsArray_default;
584
+ exports.fillArray = fillArray_default;
585
+ exports.formatDateAndTime = formatDateAndTime_default;
586
+ exports.getRandomNumber = getRandomNumber_default;
587
+ exports.getRecordKeys = getRecordKeys_default;
588
+ exports.httpErrorCodeLookup = httpErrorCodeLookup;
589
+ exports.interpolate = interpolate_default;
590
+ exports.interpolateObjects = interpolateObjects_default;
591
+ exports.isAnniversary = isAnniversary_default;
592
+ exports.isLeapYear = isLeapYear_default;
593
+ exports.isMonthlyMultiple = isMonthlyMultiple_default;
594
+ exports.isOrdered = isOrdered_default;
595
+ exports.isSameDate = isSameDate_default;
596
+ exports.kebabToCamel = kebabToCamel_default;
597
+ exports.normaliseImportPath = normaliseImportPath;
598
+ exports.normalizeImportPath = normalizeImportPath_default;
599
+ exports.omitProperties = omitProperties_default;
600
+ exports.paralleliseArrays = paralleliseArrays_default;
601
+ exports.parseBoolean = parseBoolean_default;
602
+ exports.parseEmail = Email_default;
603
+ exports.parseEnv = Env_default;
604
+ exports.parseFormData = parseFormData_default;
605
+ exports.parseIntStrict = parseIntStrict_default;
606
+ exports.parseUUID = UUID_default;
607
+ exports.parseZodSchema = parseZodSchema_default;
608
+ exports.randomiseArray = randomiseArray_default;
609
+ exports.range = range_default;
610
+ exports.removeDuplicates = removeDuplicates_default;
611
+ exports.removeIndents = removeIndents_default;
612
+ exports.stringListToArray = stringListToArray_default;
613
+ exports.stringToBoolean = stringToBoolean;
614
+ exports.truncate = truncate_default;
615
+ exports.wait = wait_default;