@alextheman/utility 4.12.3 → 4.14.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 +476 -349
- package/dist/index.d.cts +67 -6
- package/dist/index.d.ts +67 -6
- package/dist/index.js +419 -296
- package/package.json +11 -9
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -34,17 +35,14 @@ libsodium_wrappers = __toESM(libsodium_wrappers);
|
|
|
34
35
|
|
|
35
36
|
//#region src/constants/FILE_PATH_REGEX.ts
|
|
36
37
|
const FILE_PATH_REGEX = String.raw`^(?<directory>.+)[\/\\](?<base>[^\/\\]+)$`;
|
|
37
|
-
var FILE_PATH_REGEX_default = FILE_PATH_REGEX;
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/constants/NAMESPACE_EXPORT_REGEX.ts
|
|
41
41
|
const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
|
|
42
|
-
var NAMESPACE_EXPORT_REGEX_default = NAMESPACE_EXPORT_REGEX;
|
|
43
42
|
|
|
44
43
|
//#endregion
|
|
45
44
|
//#region src/constants/VERSION_NUMBER_REGEX.ts
|
|
46
45
|
const VERSION_NUMBER_REGEX = "^(?:v)?(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$";
|
|
47
|
-
var VERSION_NUMBER_REGEX_default = VERSION_NUMBER_REGEX;
|
|
48
46
|
|
|
49
47
|
//#endregion
|
|
50
48
|
//#region src/functions/arrayHelpers/fillArray.ts
|
|
@@ -72,7 +70,6 @@ function fillArray(callback, length = 1) {
|
|
|
72
70
|
})) return Promise.all(outputArray);
|
|
73
71
|
return outputArray;
|
|
74
72
|
}
|
|
75
|
-
var fillArray_default = fillArray;
|
|
76
73
|
|
|
77
74
|
//#endregion
|
|
78
75
|
//#region src/functions/arrayHelpers/paralleliseArrays.ts
|
|
@@ -97,7 +94,6 @@ function paralleliseArrays(firstArray, secondArray) {
|
|
|
97
94
|
for (let i = 0; i < firstArray.length; i++) outputArray.push([firstArray[i], secondArray[i]]);
|
|
98
95
|
return outputArray;
|
|
99
96
|
}
|
|
100
|
-
var paralleliseArrays_default = paralleliseArrays;
|
|
101
97
|
|
|
102
98
|
//#endregion
|
|
103
99
|
//#region src/types/APIError.ts
|
|
@@ -141,7 +137,6 @@ var APIError = class extends Error {
|
|
|
141
137
|
return typeof data === "object" && data !== null && typeof data?.status === "number" && typeof data?.message === "string";
|
|
142
138
|
}
|
|
143
139
|
};
|
|
144
|
-
var APIError_default = APIError;
|
|
145
140
|
|
|
146
141
|
//#endregion
|
|
147
142
|
//#region src/types/DataError.ts
|
|
@@ -180,7 +175,6 @@ var DataError = class extends Error {
|
|
|
180
175
|
return typeof data === "object" && data !== null && typeof data.message === "string" && typeof data.code === "string" && "data" in data;
|
|
181
176
|
}
|
|
182
177
|
};
|
|
183
|
-
var DataError_default = DataError;
|
|
184
178
|
|
|
185
179
|
//#endregion
|
|
186
180
|
//#region src/types/VersionNumber.ts
|
|
@@ -206,18 +200,18 @@ var VersionNumber = class VersionNumber {
|
|
|
206
200
|
this.minor = input.minor;
|
|
207
201
|
this.patch = input.patch;
|
|
208
202
|
} else if (typeof input === "string") {
|
|
209
|
-
if (!RegExp(
|
|
203
|
+
if (!RegExp(VERSION_NUMBER_REGEX).test(input)) throw new DataError(input, "INVALID_VERSION", `"${input}" is not a valid version number. Version numbers must be of the format "X.Y.Z" or "vX.Y.Z", where X, Y, and Z are non-negative integers.`);
|
|
210
204
|
const [major, minor, patch] = VersionNumber.formatString(input, { omitPrefix: true }).split(".").map((number) => {
|
|
211
|
-
return
|
|
205
|
+
return parseIntStrict(number);
|
|
212
206
|
});
|
|
213
207
|
this.major = major;
|
|
214
208
|
this.minor = minor;
|
|
215
209
|
this.patch = patch;
|
|
216
210
|
} else if (Array.isArray(input)) {
|
|
217
|
-
if (input.length !== 3) throw new
|
|
211
|
+
if (input.length !== 3) throw new DataError(input, "INVALID_LENGTH", VersionNumber.NON_NEGATIVE_TUPLE_ERROR);
|
|
218
212
|
const [major, minor, patch] = input.map((number) => {
|
|
219
|
-
const parsedInteger =
|
|
220
|
-
if (parsedInteger < 0) throw new
|
|
213
|
+
const parsedInteger = parseIntStrict(number?.toString());
|
|
214
|
+
if (parsedInteger < 0) throw new DataError(input, "NEGATIVE_INPUTS", VersionNumber.NON_NEGATIVE_TUPLE_ERROR);
|
|
221
215
|
return parsedInteger;
|
|
222
216
|
});
|
|
223
217
|
this.major = major;
|
|
@@ -287,7 +281,7 @@ var VersionNumber = class VersionNumber {
|
|
|
287
281
|
* @returns A stringified representation of the current version number, prefixed with `v`.
|
|
288
282
|
*/
|
|
289
283
|
[Symbol.toPrimitive](hint) {
|
|
290
|
-
if (hint === "number") throw new
|
|
284
|
+
if (hint === "number") throw new DataError(this.toString(), "INVALID_COERCION", "VersionNumber cannot be coerced to a number type.");
|
|
291
285
|
return this.toString();
|
|
292
286
|
}
|
|
293
287
|
/**
|
|
@@ -310,7 +304,6 @@ var VersionNumber = class VersionNumber {
|
|
|
310
304
|
return VersionNumber.formatString(rawString, options);
|
|
311
305
|
}
|
|
312
306
|
};
|
|
313
|
-
var VersionNumber_default = VersionNumber;
|
|
314
307
|
|
|
315
308
|
//#endregion
|
|
316
309
|
//#region src/functions/parsers/parseIntStrict.ts
|
|
@@ -329,21 +322,20 @@ var VersionNumber_default = VersionNumber;
|
|
|
329
322
|
function parseIntStrict(string, radix) {
|
|
330
323
|
const trimmedString = string.trim();
|
|
331
324
|
const maxAllowedAlphabeticalCharacter = radix && radix > 10 && radix <= 36 ? String.fromCharCode(87 + radix - 1) : void 0;
|
|
332
|
-
if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${maxAllowedAlphabeticalCharacter}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw new
|
|
325
|
+
if (!(radix && radix > 10 && radix <= 36 ? new RegExp(`^[+-]?[0-9a-${maxAllowedAlphabeticalCharacter}]+$`, "i") : /^[+-]?\d+$/).test(trimmedString)) throw new DataError(radix ? {
|
|
333
326
|
string,
|
|
334
327
|
radix
|
|
335
328
|
} : string, "INTEGER_PARSING_ERROR", `Only numeric values${radix && radix > 10 && radix <= 36 ? ` or character${radix !== 11 ? "s" : ""} A${radix !== 11 ? `-${maxAllowedAlphabeticalCharacter?.toUpperCase()} ` : " "}` : " "}are allowed.`);
|
|
336
329
|
if (radix && radix < 10 && [...trimmedString].some((character) => {
|
|
337
330
|
return parseInt(character) >= radix;
|
|
338
|
-
})) throw new
|
|
331
|
+
})) throw new DataError({
|
|
339
332
|
string,
|
|
340
333
|
radix
|
|
341
334
|
}, "INTEGER_PARSING_ERROR", "Value contains one or more digits outside of the range of the given radix.");
|
|
342
335
|
const parseIntResult = parseInt(trimmedString, radix);
|
|
343
|
-
if (isNaN(parseIntResult)) throw new
|
|
336
|
+
if (isNaN(parseIntResult)) throw new DataError(string, "INTEGER_PARSING_ERROR", "Value is not a valid integer.");
|
|
344
337
|
return parseIntResult;
|
|
345
338
|
}
|
|
346
|
-
var parseIntStrict_default = parseIntStrict;
|
|
347
339
|
|
|
348
340
|
//#endregion
|
|
349
341
|
//#region src/functions/miscellaneous/getRandomNumber.ts
|
|
@@ -358,11 +350,10 @@ var parseIntStrict_default = parseIntStrict;
|
|
|
358
350
|
* @returns A random number between the provided lower bound and upper bound.
|
|
359
351
|
*/
|
|
360
352
|
function getRandomNumber(lowerBound, upperBound) {
|
|
361
|
-
const parsedLowerBound =
|
|
362
|
-
const parsedUpperBound =
|
|
353
|
+
const parsedLowerBound = parseIntStrict(`${lowerBound}`);
|
|
354
|
+
const parsedUpperBound = parseIntStrict(`${upperBound}`);
|
|
363
355
|
return Math.floor(Math.random() * (parsedUpperBound - parsedLowerBound + 1) + parsedLowerBound);
|
|
364
356
|
}
|
|
365
|
-
var getRandomNumber_default = getRandomNumber;
|
|
366
357
|
|
|
367
358
|
//#endregion
|
|
368
359
|
//#region src/functions/arrayHelpers/randomiseArray.ts
|
|
@@ -381,12 +372,11 @@ function randomiseArray(array) {
|
|
|
381
372
|
const mutableArray = [...array];
|
|
382
373
|
const outputArray = [];
|
|
383
374
|
do {
|
|
384
|
-
const indexToRemove =
|
|
375
|
+
const indexToRemove = getRandomNumber(0, mutableArray.length - 1);
|
|
385
376
|
outputArray.push(mutableArray.splice(indexToRemove, 1)[0]);
|
|
386
377
|
} while (mutableArray.length > 0);
|
|
387
378
|
return outputArray;
|
|
388
379
|
}
|
|
389
|
-
var randomiseArray_default = randomiseArray;
|
|
390
380
|
|
|
391
381
|
//#endregion
|
|
392
382
|
//#region src/functions/arrayHelpers/range.ts
|
|
@@ -419,7 +409,6 @@ function range(start, stop, step = 1) {
|
|
|
419
409
|
}
|
|
420
410
|
return numbers;
|
|
421
411
|
}
|
|
422
|
-
var range_default = range;
|
|
423
412
|
|
|
424
413
|
//#endregion
|
|
425
414
|
//#region src/functions/arrayHelpers/removeDuplicates.ts
|
|
@@ -439,7 +428,6 @@ function removeDuplicates(array) {
|
|
|
439
428
|
for (const item of array) if (!outputArray.includes(item)) outputArray.push(item);
|
|
440
429
|
return outputArray;
|
|
441
430
|
}
|
|
442
|
-
var removeDuplicates_default = removeDuplicates;
|
|
443
431
|
|
|
444
432
|
//#endregion
|
|
445
433
|
//#region src/functions/date/addDaysToDate.ts
|
|
@@ -458,7 +446,6 @@ function addDaysToDate(currentDate = /* @__PURE__ */ new Date(), dayIncrement =
|
|
|
458
446
|
newDate.setDate(newDate.getDate() + dayIncrement);
|
|
459
447
|
return newDate;
|
|
460
448
|
}
|
|
461
|
-
var addDaysToDate_default = addDaysToDate;
|
|
462
449
|
|
|
463
450
|
//#endregion
|
|
464
451
|
//#region src/functions/date/isSameDate.ts
|
|
@@ -475,7 +462,6 @@ var addDaysToDate_default = addDaysToDate;
|
|
|
475
462
|
function isSameDate(firstDate, secondDate) {
|
|
476
463
|
return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth() && firstDate.getFullYear() === secondDate.getFullYear();
|
|
477
464
|
}
|
|
478
|
-
var isSameDate_default = isSameDate;
|
|
479
465
|
|
|
480
466
|
//#endregion
|
|
481
467
|
//#region src/functions/date/formatDateAndTime.ts
|
|
@@ -493,14 +479,13 @@ var isSameDate_default = isSameDate;
|
|
|
493
479
|
* - For any other date, the output will be something like `DD/MM/YYYY, HH:MM`
|
|
494
480
|
*/
|
|
495
481
|
function formatDateAndTime(inputDate) {
|
|
496
|
-
const yesterday =
|
|
482
|
+
const yesterday = addDaysToDate(/* @__PURE__ */ new Date(), -1);
|
|
497
483
|
const today = /* @__PURE__ */ new Date();
|
|
498
484
|
const inputTime = `${inputDate.getHours().toString().padStart(2, "0")}:${inputDate.getMinutes().toString().padStart(2, "0")}`;
|
|
499
|
-
if (
|
|
500
|
-
if (
|
|
485
|
+
if (isSameDate(inputDate, yesterday)) return `Yesterday at ${inputTime}`;
|
|
486
|
+
if (isSameDate(inputDate, today)) return `Today at ${inputTime}`;
|
|
501
487
|
return `${inputDate.getDate().toString().padStart(2, "0")}/${(inputDate.getMonth() + 1).toString().padStart(2, "0")}/${inputDate.getFullYear().toString()}, ${inputTime}`;
|
|
502
488
|
}
|
|
503
|
-
var formatDateAndTime_default = formatDateAndTime;
|
|
504
489
|
|
|
505
490
|
//#endregion
|
|
506
491
|
//#region src/functions/date/isLeapYear.ts
|
|
@@ -516,15 +501,14 @@ var formatDateAndTime_default = formatDateAndTime;
|
|
|
516
501
|
* @returns True if the year is a leap year, and false otherwise.
|
|
517
502
|
*/
|
|
518
503
|
function isLeapYear(year) {
|
|
519
|
-
const parsedYear =
|
|
504
|
+
const parsedYear = parseIntStrict(`${year}`);
|
|
520
505
|
return parsedYear % 4 === 0 && parsedYear % 100 !== 0 || parsedYear % 400 === 0;
|
|
521
506
|
}
|
|
522
|
-
var isLeapYear_default = isLeapYear;
|
|
523
507
|
|
|
524
508
|
//#endregion
|
|
525
509
|
//#region src/functions/date/isAnniversary.ts
|
|
526
510
|
function checkLeapYear(firstDate, secondDate) {
|
|
527
|
-
if (
|
|
511
|
+
if (isLeapYear(firstDate.getFullYear()) && firstDate.getMonth() === 1 && secondDate.getMonth() === 1) return firstDate.getDate() === 29 && secondDate.getDate() === 28;
|
|
528
512
|
return false;
|
|
529
513
|
}
|
|
530
514
|
/**
|
|
@@ -541,7 +525,6 @@ function isAnniversary(firstDate, secondDate) {
|
|
|
541
525
|
if (checkLeapYear(firstDate, secondDate) || checkLeapYear(secondDate, firstDate)) return true;
|
|
542
526
|
return firstDate.getDate() === secondDate.getDate() && firstDate.getMonth() === secondDate.getMonth();
|
|
543
527
|
}
|
|
544
|
-
var isAnniversary_default = isAnniversary;
|
|
545
528
|
|
|
546
529
|
//#endregion
|
|
547
530
|
//#region src/functions/date/isMonthlyMultiple.ts
|
|
@@ -556,7 +539,7 @@ function endOfMonthChecksButNotFebruary(firstDate, secondDate) {
|
|
|
556
539
|
}
|
|
557
540
|
function nonLeapYearFebruaryChecks(firstDate, secondDate) {
|
|
558
541
|
if (firstDate.getMonth() === 1) {
|
|
559
|
-
if (!
|
|
542
|
+
if (!isLeapYear(firstDate.getFullYear()) && firstDate.getDate() === 28) return [
|
|
560
543
|
28,
|
|
561
544
|
29,
|
|
562
545
|
30,
|
|
@@ -567,7 +550,7 @@ function nonLeapYearFebruaryChecks(firstDate, secondDate) {
|
|
|
567
550
|
}
|
|
568
551
|
function leapYearFebruaryChecks(firstDate, secondDate) {
|
|
569
552
|
if (firstDate.getMonth() === 1) {
|
|
570
|
-
if (
|
|
553
|
+
if (isLeapYear(firstDate.getFullYear()) && firstDate.getDate() === 29) return [
|
|
571
554
|
29,
|
|
572
555
|
30,
|
|
573
556
|
31
|
|
@@ -591,7 +574,6 @@ function isMonthlyMultiple(firstDate, secondDate) {
|
|
|
591
574
|
if (leapYearFebruaryChecks(firstDate, secondDate) || leapYearFebruaryChecks(secondDate, firstDate)) return true;
|
|
592
575
|
return firstDate.getDate() === secondDate.getDate();
|
|
593
576
|
}
|
|
594
|
-
var isMonthlyMultiple_default = isMonthlyMultiple;
|
|
595
577
|
|
|
596
578
|
//#endregion
|
|
597
579
|
//#region src/functions/miscellaneous/convertFileToBase64.ts
|
|
@@ -622,7 +604,6 @@ function convertFileToBase64(file) {
|
|
|
622
604
|
};
|
|
623
605
|
});
|
|
624
606
|
}
|
|
625
|
-
var convertFileToBase64_default = convertFileToBase64;
|
|
626
607
|
|
|
627
608
|
//#endregion
|
|
628
609
|
//#region src/functions/miscellaneous/createFormData.ts
|
|
@@ -692,7 +673,6 @@ function createFormData(data, options = {
|
|
|
692
673
|
} else formData.append(String(key), String(value));
|
|
693
674
|
return formData;
|
|
694
675
|
}
|
|
695
|
-
var createFormData_default = createFormData;
|
|
696
676
|
|
|
697
677
|
//#endregion
|
|
698
678
|
//#region src/functions/miscellaneous/isOrdered.ts
|
|
@@ -711,7 +691,385 @@ function isOrdered(array) {
|
|
|
711
691
|
for (const index in newArray) if (newArray[index] !== array[index]) return false;
|
|
712
692
|
return true;
|
|
713
693
|
}
|
|
714
|
-
|
|
694
|
+
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region src/functions/recursive/deepFreeze.ts
|
|
697
|
+
/**
|
|
698
|
+
* Deeply freezes an object or array such that all child objects/arrays are also frozen.
|
|
699
|
+
*
|
|
700
|
+
* Note that this will also freeze the input itself as well.
|
|
701
|
+
* If the intent is to create a newly frozen object with a different reference in memory, pass your object through deepCopy first before passing to deepFreeze.
|
|
702
|
+
*
|
|
703
|
+
* @category Recursive
|
|
704
|
+
*
|
|
705
|
+
* @template ObjectType - The type of the input object.
|
|
706
|
+
*
|
|
707
|
+
* @param object - The object to freeze. May also be an array.
|
|
708
|
+
*
|
|
709
|
+
* @returns The input object completely frozen.
|
|
710
|
+
*/
|
|
711
|
+
function deepFreeze(object) {
|
|
712
|
+
for (const value of Object.values(object)) {
|
|
713
|
+
if (typeof value === "function") continue;
|
|
714
|
+
if (value && typeof value === "object") deepFreeze(value);
|
|
715
|
+
}
|
|
716
|
+
return Object.freeze(object);
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
//#endregion
|
|
720
|
+
//#region src/functions/taggedTemplate/createTemplateStringsArray.ts
|
|
721
|
+
/**
|
|
722
|
+
* Creates a template strings array given a regular array of strings
|
|
723
|
+
*
|
|
724
|
+
* @category Tagged Template
|
|
725
|
+
*
|
|
726
|
+
* @param strings - The array of strings.
|
|
727
|
+
*
|
|
728
|
+
* @returns A template strings array that can be passed as the first argument of any tagged template function.
|
|
729
|
+
*/
|
|
730
|
+
function createTemplateStringsArray(strings) {
|
|
731
|
+
return deepFreeze(Object.assign([...strings], { raw: [...strings] }));
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/functions/taggedTemplate/getInterpolations.ts
|
|
736
|
+
/**
|
|
737
|
+
*
|
|
738
|
+
* Gets the strings and interpolations separately from a template string.
|
|
739
|
+
* You can pass a template string directly by doing:
|
|
740
|
+
*
|
|
741
|
+
* ```typescript
|
|
742
|
+
* getInterpolations`Template string here`.
|
|
743
|
+
* ```
|
|
744
|
+
*
|
|
745
|
+
* @category Tagged Template
|
|
746
|
+
*
|
|
747
|
+
* @deprecated Please use `getStringsAndInterpolations` instead.
|
|
748
|
+
*
|
|
749
|
+
* @param strings - The strings from the template to process.
|
|
750
|
+
* @param interpolations - An array of all interpolations from the template.
|
|
751
|
+
*
|
|
752
|
+
* @returns A tuple where the first item is the strings from the template, and the second is the interpolations.
|
|
753
|
+
*/
|
|
754
|
+
function getInterpolations(strings, ...interpolations) {
|
|
755
|
+
return [strings, interpolations];
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
//#endregion
|
|
759
|
+
//#region src/functions/taggedTemplate/getStringsAndInterpolations.ts
|
|
760
|
+
/**
|
|
761
|
+
*
|
|
762
|
+
* Gets the strings and interpolations separately from a template string.
|
|
763
|
+
* You can pass a template string directly by doing:
|
|
764
|
+
*
|
|
765
|
+
* ```typescript
|
|
766
|
+
* getStringsAndInterpolations`Template string here`;
|
|
767
|
+
* ```
|
|
768
|
+
*
|
|
769
|
+
* @category Tagged Template
|
|
770
|
+
*
|
|
771
|
+
* @template InterpolationsType - The type of the interpolations.
|
|
772
|
+
*
|
|
773
|
+
* @param strings - The strings from the template to process.
|
|
774
|
+
* @param interpolations - An array of all interpolations from the template.
|
|
775
|
+
*
|
|
776
|
+
* @returns A tuple where the first item is the strings from the template, and the remaining items are the interpolations.
|
|
777
|
+
*
|
|
778
|
+
* The return of this function may also be spread into any other tagged template function in the following way:
|
|
779
|
+
*
|
|
780
|
+
* ```typescript
|
|
781
|
+
* import { interpolate } from "@alextheman/utility"; // Example function
|
|
782
|
+
*
|
|
783
|
+
* const packageName = "@alextheman/utility";
|
|
784
|
+
* const packageManager = getPackageManager(packageName);
|
|
785
|
+
*
|
|
786
|
+
* interpolate(...getStringsAndInterpolations`The package ${packageName} uses the ${packageManager} package manager.`);
|
|
787
|
+
* ```
|
|
788
|
+
*/
|
|
789
|
+
function getStringsAndInterpolations(strings, ...interpolations) {
|
|
790
|
+
if (strings.length !== interpolations.length + 1) throw new DataError({
|
|
791
|
+
stringsLength: strings.length,
|
|
792
|
+
interpolationsLength: interpolations.length,
|
|
793
|
+
strings,
|
|
794
|
+
interpolations
|
|
795
|
+
}, "INVALID_STRINGS_AND_INTERPOLATIONS_LENGTH", "The length of the strings must be exactly one more than the length of the interpolations.");
|
|
796
|
+
return [createTemplateStringsArray(strings), ...interpolations];
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/functions/taggedTemplate/interpolate.ts
|
|
801
|
+
/**
|
|
802
|
+
* Returns the result of interpolating a template string when given the strings and interpolations separately.
|
|
803
|
+
*
|
|
804
|
+
* You can pass a template string directly by doing:
|
|
805
|
+
*
|
|
806
|
+
* ```
|
|
807
|
+
* interpolate`Template string here`;
|
|
808
|
+
* ```
|
|
809
|
+
*
|
|
810
|
+
* In this case, it will be functionally the same as if you just wrote the template string by itself.
|
|
811
|
+
*
|
|
812
|
+
* @category Tagged Template
|
|
813
|
+
*
|
|
814
|
+
* @template InterpolationsType - The type of the interpolations.
|
|
815
|
+
*
|
|
816
|
+
* @param strings - The strings from the template to process.
|
|
817
|
+
* @param interpolations - An array of all interpolations from the template.
|
|
818
|
+
*
|
|
819
|
+
* @returns A new string with the strings and interpolations from the template applied.
|
|
820
|
+
*/
|
|
821
|
+
function interpolate(strings, ...interpolations) {
|
|
822
|
+
let result = "";
|
|
823
|
+
for (const [string, interpolation = ""] of paralleliseArrays(strings, interpolations)) result += string + interpolation;
|
|
824
|
+
return result;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
//#endregion
|
|
828
|
+
//#region src/functions/taggedTemplate/interpolateObjects.ts
|
|
829
|
+
/**
|
|
830
|
+
* Returns the result of interpolating a template string, also stringifying objects.
|
|
831
|
+
*
|
|
832
|
+
* You can pass a template string directly by doing:
|
|
833
|
+
*
|
|
834
|
+
* ```typescript
|
|
835
|
+
* interpolateObjects`Template string here ${{ my: "object" }}`;
|
|
836
|
+
* ```
|
|
837
|
+
*
|
|
838
|
+
* @category Tagged Template
|
|
839
|
+
*
|
|
840
|
+
* @template InterpolationsType - The type of the interpolations.
|
|
841
|
+
*
|
|
842
|
+
* @param strings - The strings from the template to process.
|
|
843
|
+
* @param interpolations - An array of all interpolations from the template.
|
|
844
|
+
*
|
|
845
|
+
* @returns A new string with the strings and interpolations from the template applied, with objects stringified.
|
|
846
|
+
*/
|
|
847
|
+
function interpolateObjects(strings, ...interpolations) {
|
|
848
|
+
let result = "";
|
|
849
|
+
for (let i = 0; i < strings.length; i++) {
|
|
850
|
+
result += strings[i];
|
|
851
|
+
if (i !== strings.length - 1) result += interpolations[i] && typeof interpolations[i] === "object" ? JSON.stringify(interpolations[i]) : interpolations[i];
|
|
852
|
+
}
|
|
853
|
+
return result;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
//#endregion
|
|
857
|
+
//#region src/functions/taggedTemplate/isTemplateStringsArray.ts
|
|
858
|
+
/**
|
|
859
|
+
* Determines whether or not the input is a valid `TemplateStringsArray`.
|
|
860
|
+
*
|
|
861
|
+
* @category Tagged Template
|
|
862
|
+
*
|
|
863
|
+
* @param input - The input to check
|
|
864
|
+
*
|
|
865
|
+
* @returns `true` if the input is a valid `TemplateStringsArray`, and false otherwise. The type of the input will also be narrowed down to `TemplateStringsArray` if `true`.
|
|
866
|
+
*/
|
|
867
|
+
function isTemplateStringsArray(input) {
|
|
868
|
+
return typeof input === "object" && input !== null && "raw" in input;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
//#endregion
|
|
872
|
+
//#region src/functions/taggedTemplate/normaliseIndents.ts
|
|
873
|
+
function calculateTabSize(line, whitespaceLength) {
|
|
874
|
+
const potentialWhitespacePart = line.slice(0, whitespaceLength);
|
|
875
|
+
const trimmedString = line.trimStart();
|
|
876
|
+
if (potentialWhitespacePart.trim() !== "") return 0;
|
|
877
|
+
const tabSize = line.length - (trimmedString.length + whitespaceLength);
|
|
878
|
+
return tabSize < 0 ? 0 : tabSize;
|
|
879
|
+
}
|
|
880
|
+
function getWhitespaceLength(lines) {
|
|
881
|
+
const [firstNonEmptyLine] = lines.filter((line) => {
|
|
882
|
+
return line.trim() !== "";
|
|
883
|
+
});
|
|
884
|
+
return firstNonEmptyLine.length - firstNonEmptyLine.trimStart().length;
|
|
885
|
+
}
|
|
886
|
+
function reduceLines(lines, { preserveTabs = true }) {
|
|
887
|
+
const slicedLines = lines.slice(1);
|
|
888
|
+
const isFirstLineEmpty = lines[0].trim() === "";
|
|
889
|
+
const whitespaceLength = getWhitespaceLength(isFirstLineEmpty ? lines : slicedLines);
|
|
890
|
+
return (isFirstLineEmpty ? slicedLines : lines).map((line) => {
|
|
891
|
+
const tabSize = calculateTabSize(line, whitespaceLength);
|
|
892
|
+
return (preserveTabs ? fillArray(() => {
|
|
893
|
+
return " ";
|
|
894
|
+
}, tabSize).join("") : "") + line.trimStart();
|
|
895
|
+
}).join("\n");
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Applies any options if provided, then removes any extraneous indents from a multi-line template string.
|
|
899
|
+
*
|
|
900
|
+
* You can pass a template string directly by doing:
|
|
901
|
+
*
|
|
902
|
+
* ```typescript
|
|
903
|
+
* normaliseIndents`Template string here
|
|
904
|
+
* with a new line
|
|
905
|
+
* and another new line`;
|
|
906
|
+
* ```
|
|
907
|
+
*
|
|
908
|
+
* You may also pass the options first, then invoke the resulting function with a template string:
|
|
909
|
+
*
|
|
910
|
+
* ```typescript
|
|
911
|
+
* normaliseIndents({ preserveTabs: false })`Template string here
|
|
912
|
+
* with a new line
|
|
913
|
+
* and another new line`;
|
|
914
|
+
* ```
|
|
915
|
+
*
|
|
916
|
+
* @category Tagged Template
|
|
917
|
+
*
|
|
918
|
+
* @param first - The strings from the template to process, or the options to apply.
|
|
919
|
+
* @param args - An array of all interpolations from the template.
|
|
920
|
+
*
|
|
921
|
+
* @returns An additional function to invoke, or a new string with the strings and interpolations from the template applied, and extraneous indents removed.
|
|
922
|
+
*/
|
|
923
|
+
function normaliseIndents(first, ...args) {
|
|
924
|
+
if (typeof first === "object" && first !== null && !Array.isArray(first)) {
|
|
925
|
+
const options = first;
|
|
926
|
+
return (strings, ...interpolations) => {
|
|
927
|
+
return normaliseIndents(strings, ...interpolations, options);
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
const strings = first;
|
|
931
|
+
const options = typeof args[args.length - 1] === "object" && !Array.isArray(args[args.length - 1]) ? args.pop() : {};
|
|
932
|
+
return reduceLines(interpolate(strings, ...[...args]).split("\n"), options);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Applies any options if provided, then removes any extraneous indents from a multi-line template string.
|
|
936
|
+
*
|
|
937
|
+
* You can pass a template string directly by doing:
|
|
938
|
+
*
|
|
939
|
+
* ```typescript
|
|
940
|
+
* normalizeIndents`Template string here
|
|
941
|
+
* with a new line
|
|
942
|
+
* and another new line`.
|
|
943
|
+
* ```
|
|
944
|
+
*
|
|
945
|
+
* You may also pass the options first, then invoke the resulting function with a template string:
|
|
946
|
+
*
|
|
947
|
+
* ```typescript
|
|
948
|
+
* normalizeIndents({ preserveTabs: false })`Template string here
|
|
949
|
+
* with a new line
|
|
950
|
+
* and another new line`.
|
|
951
|
+
* ```
|
|
952
|
+
*
|
|
953
|
+
* @param first - The strings from the template to process, or the options to apply.
|
|
954
|
+
* @param args - An array of all interpolations from the template.
|
|
955
|
+
*
|
|
956
|
+
* @returns An additional function to invoke, or a new string with the strings and interpolations from the template applied, and extraneous indents removed.
|
|
957
|
+
*/
|
|
958
|
+
const normalizeIndents = normaliseIndents;
|
|
959
|
+
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/functions/miscellaneous/sayHello.ts
|
|
962
|
+
/**
|
|
963
|
+
* Returns a string representing the lyrics to the package's theme song, Commit To You
|
|
964
|
+
*
|
|
965
|
+
* [Pls listen!](https://www.youtube.com/watch?v=mH-Sg-8EnxM)
|
|
966
|
+
*
|
|
967
|
+
* @returns The lyrics string in markdown format.
|
|
968
|
+
*/
|
|
969
|
+
function sayHello() {
|
|
970
|
+
return normaliseIndents`
|
|
971
|
+
# Commit To You
|
|
972
|
+
|
|
973
|
+
### Verse 1
|
|
974
|
+
|
|
975
|
+
I know you've been checking me out,
|
|
976
|
+
Shall we take it to the next level now?
|
|
977
|
+
'Cause I really wanna be there all for you,
|
|
978
|
+
All for you!
|
|
979
|
+
Come on now, let's make a fresh start!
|
|
980
|
+
Pin my number, then you can take me out!
|
|
981
|
+
Can't you see I really do care about you,
|
|
982
|
+
About you!
|
|
983
|
+
|
|
984
|
+
### Pre-chorus 1
|
|
985
|
+
Although our calendars are imperfect, at best,
|
|
986
|
+
I'd like to organise time with you! (with you!).
|
|
987
|
+
Just tell me when and I'll make it clear,
|
|
988
|
+
All clear for you,
|
|
989
|
+
All clear for you!
|
|
990
|
+
(One, two, three, go!)
|
|
991
|
+
|
|
992
|
+
### Chorus
|
|
993
|
+
I wanna be of utility, I'll help you on the run!
|
|
994
|
+
I'll be the one here in the back, while you go have some fun!
|
|
995
|
+
Looking out for you tonight, I'll be the one you can rely on!
|
|
996
|
+
Watch you go and watch me pass by,
|
|
997
|
+
I'll be here!
|
|
998
|
+
I'll commit to you!
|
|
999
|
+
|
|
1000
|
+
### Verse 2
|
|
1001
|
+
Though sometimes it won't be easy,
|
|
1002
|
+
You'll be here to bring out the best in me,
|
|
1003
|
+
And I'll hold myself to high standards for you!
|
|
1004
|
+
All for you!
|
|
1005
|
+
We'll grow as a pair, you and me,
|
|
1006
|
+
We'll build up a healthy dependency,
|
|
1007
|
+
You can build with me and I'll develop with you!
|
|
1008
|
+
I'm with you!
|
|
1009
|
+
|
|
1010
|
+
### Pre-chorus 2
|
|
1011
|
+
I'll be with you when you're up or you're down,
|
|
1012
|
+
We'll deal with all our problems together (together!)
|
|
1013
|
+
Just tell me what you want, I'll make it clear,
|
|
1014
|
+
All clear for you,
|
|
1015
|
+
All clear for you!
|
|
1016
|
+
(One, three, one, go!)
|
|
1017
|
+
|
|
1018
|
+
### Chorus
|
|
1019
|
+
I wanna be of utility, I'll help you on the run!
|
|
1020
|
+
(help you on the run!)
|
|
1021
|
+
I'll be the one here in the back, while you go have some fun!
|
|
1022
|
+
(you go have some fun!)
|
|
1023
|
+
Looking out for you tonight, I'll be the one you can rely on!
|
|
1024
|
+
Watch you go and watch me pass by,
|
|
1025
|
+
I'll be here!
|
|
1026
|
+
I'll commit to you!
|
|
1027
|
+
|
|
1028
|
+
### Bridge
|
|
1029
|
+
Looking into our stack!
|
|
1030
|
+
I'll commit to you!
|
|
1031
|
+
We've got a lot to unpack!
|
|
1032
|
+
I'll commit to you!
|
|
1033
|
+
The environment that we're in!
|
|
1034
|
+
I'll commit to you!
|
|
1035
|
+
Delicate as a string!
|
|
1036
|
+
I'll commit to you!
|
|
1037
|
+
|
|
1038
|
+
But I think you're my type!
|
|
1039
|
+
I'll commit to you!
|
|
1040
|
+
Oh, this feels all so right!
|
|
1041
|
+
I'll commit to you!
|
|
1042
|
+
Nothing stopping us now!
|
|
1043
|
+
I'll commit to you!
|
|
1044
|
+
Let's show them what we're about!
|
|
1045
|
+
Two, three, four, go!
|
|
1046
|
+
|
|
1047
|
+
### Final Chorus
|
|
1048
|
+
I wanna be of utility, I'll help you on the run!
|
|
1049
|
+
(help you on the run!)
|
|
1050
|
+
I'll be the one here in the back, while you go have some fun!
|
|
1051
|
+
(you go have some fun!)
|
|
1052
|
+
Looking out for you tonight, I'll be the one you can rely on!
|
|
1053
|
+
Watch you go and watch me pass by,
|
|
1054
|
+
I'll be here!
|
|
1055
|
+
I'll commit to you!
|
|
1056
|
+
|
|
1057
|
+
I wanna be of utility, I'll help you on the run!
|
|
1058
|
+
(I'll commit to you!)
|
|
1059
|
+
I'll be the one here in the back, while you go have some fun!
|
|
1060
|
+
(I'll commit to you!)
|
|
1061
|
+
Looking out for you tonight, I'll be the one you can rely on!
|
|
1062
|
+
(I'll commit to you!)
|
|
1063
|
+
Watch you go and watch me pass by,
|
|
1064
|
+
(I'll commit to you!)
|
|
1065
|
+
I'll be here!
|
|
1066
|
+
|
|
1067
|
+
### Outro
|
|
1068
|
+
I'll commit to you!
|
|
1069
|
+
I'll commit to you!
|
|
1070
|
+
I'll commit to you!
|
|
1071
|
+
`;
|
|
1072
|
+
}
|
|
715
1073
|
|
|
716
1074
|
//#endregion
|
|
717
1075
|
//#region src/functions/miscellaneous/stringifyDotenv.ts
|
|
@@ -728,8 +1086,8 @@ function stringifyDotenv(contents, options) {
|
|
|
728
1086
|
const { quoteStyle = "double" } = options ?? {};
|
|
729
1087
|
let result = "";
|
|
730
1088
|
for (const key in contentsCopy) {
|
|
731
|
-
if (/[ \t\r\n]/.test(key)) throw new
|
|
732
|
-
if (quoteStyle === "none") if (/[ \t\r\n]/.test(contentsCopy[key]) || contentsCopy[key].includes("#") || contentsCopy[key].includes("=") || contentsCopy[key].includes("\\")) throw new
|
|
1089
|
+
if (/[ \t\r\n]/.test(key)) throw new DataError({ [key]: contentsCopy[key] }, "INVALID_KEY", "Environment variables are not allowed to have whitespace.");
|
|
1090
|
+
if (quoteStyle === "none") if (/[ \t\r\n]/.test(contentsCopy[key]) || contentsCopy[key].includes("#") || contentsCopy[key].includes("=") || contentsCopy[key].includes("\\")) throw new DataError({ [key]: contentsCopy[key] }, "INCOMPATIBLE_QUOTE_STYLE", "Cannot use `{ quoteStyle: \"none\" }` when value has whitespace, #, =, or \\");
|
|
733
1091
|
else {
|
|
734
1092
|
result += `${key}=${contentsCopy[key]}\n`;
|
|
735
1093
|
continue;
|
|
@@ -748,7 +1106,6 @@ function stringifyDotenv(contents, options) {
|
|
|
748
1106
|
}
|
|
749
1107
|
return result;
|
|
750
1108
|
}
|
|
751
|
-
var stringifyDotenv_default = stringifyDotenv;
|
|
752
1109
|
|
|
753
1110
|
//#endregion
|
|
754
1111
|
//#region src/functions/miscellaneous/stringListToArray.ts
|
|
@@ -771,7 +1128,6 @@ function stringListToArray(stringList, { separator = ",", trimWhitespace = true
|
|
|
771
1128
|
return item.trim();
|
|
772
1129
|
}) : arrayList;
|
|
773
1130
|
}
|
|
774
|
-
var stringListToArray_default = stringListToArray;
|
|
775
1131
|
|
|
776
1132
|
//#endregion
|
|
777
1133
|
//#region src/functions/miscellaneous/wait.ts
|
|
@@ -791,7 +1147,6 @@ function wait(seconds) {
|
|
|
791
1147
|
}, seconds * 1e3);
|
|
792
1148
|
});
|
|
793
1149
|
}
|
|
794
|
-
var wait_default = wait;
|
|
795
1150
|
|
|
796
1151
|
//#endregion
|
|
797
1152
|
//#region src/functions/objectHelpers/getRecordKeys.ts
|
|
@@ -809,7 +1164,6 @@ var wait_default = wait;
|
|
|
809
1164
|
function getRecordKeys(record) {
|
|
810
1165
|
return Object.keys(record);
|
|
811
1166
|
}
|
|
812
|
-
var getRecordKeys_default = getRecordKeys;
|
|
813
1167
|
|
|
814
1168
|
//#endregion
|
|
815
1169
|
//#region src/functions/objectHelpers/omitProperties.ts
|
|
@@ -833,7 +1187,6 @@ function omitProperties(object, keysToOmit) {
|
|
|
833
1187
|
});
|
|
834
1188
|
return outputObject;
|
|
835
1189
|
}
|
|
836
|
-
var omitProperties_default = omitProperties;
|
|
837
1190
|
|
|
838
1191
|
//#endregion
|
|
839
1192
|
//#region src/functions/objectHelpers/removeUndefinedFromObject.ts
|
|
@@ -849,7 +1202,6 @@ function removeUndefinedFromObject(object) {
|
|
|
849
1202
|
return value !== void 0;
|
|
850
1203
|
}));
|
|
851
1204
|
}
|
|
852
|
-
var removeUndefinedFromObject_default = removeUndefinedFromObject;
|
|
853
1205
|
|
|
854
1206
|
//#endregion
|
|
855
1207
|
//#region src/functions/parsers/parseBoolean.ts
|
|
@@ -866,10 +1218,9 @@ var removeUndefinedFromObject_default = removeUndefinedFromObject;
|
|
|
866
1218
|
*/
|
|
867
1219
|
function parseBoolean(inputString) {
|
|
868
1220
|
const normalisedString = inputString.toLowerCase();
|
|
869
|
-
if (!["true", "false"].includes(normalisedString)) throw new
|
|
1221
|
+
if (!["true", "false"].includes(normalisedString)) throw new DataError(inputString, "INVALID_BOOLEAN_STRING", "The provided boolean string must be one of `true | false`");
|
|
870
1222
|
return normalisedString === "true";
|
|
871
1223
|
}
|
|
872
|
-
var parseBoolean_default = parseBoolean;
|
|
873
1224
|
|
|
874
1225
|
//#endregion
|
|
875
1226
|
//#region src/functions/parsers/zod/_parseZodSchema.ts
|
|
@@ -887,7 +1238,7 @@ function _parseZodSchema(parsedResult, data, onError) {
|
|
|
887
1238
|
const code = issue.code.toUpperCase();
|
|
888
1239
|
allErrorCodes[code] = (allErrorCodes[code] ?? 0) + 1;
|
|
889
1240
|
}
|
|
890
|
-
throw new
|
|
1241
|
+
throw new DataError(data, Object.entries(allErrorCodes).toSorted(([_, firstCount], [__, secondCount]) => {
|
|
891
1242
|
return secondCount - firstCount;
|
|
892
1243
|
}).map(([code, count], _, allErrorCodes) => {
|
|
893
1244
|
return allErrorCodes.length === 1 && count === 1 ? code : `${code}×${count}`;
|
|
@@ -895,7 +1246,6 @@ function _parseZodSchema(parsedResult, data, onError) {
|
|
|
895
1246
|
}
|
|
896
1247
|
return parsedResult.data;
|
|
897
1248
|
}
|
|
898
|
-
var _parseZodSchema_default = _parseZodSchema;
|
|
899
1249
|
|
|
900
1250
|
//#endregion
|
|
901
1251
|
//#region src/functions/parsers/zod/parseZodSchema.ts
|
|
@@ -918,9 +1268,8 @@ var _parseZodSchema_default = _parseZodSchema;
|
|
|
918
1268
|
* @returns The parsed data from the Zod schema.
|
|
919
1269
|
*/
|
|
920
1270
|
function parseZodSchema(schema, data, onError) {
|
|
921
|
-
return
|
|
1271
|
+
return _parseZodSchema(schema.safeParse(data), data, onError);
|
|
922
1272
|
}
|
|
923
|
-
var parseZodSchema_default = parseZodSchema;
|
|
924
1273
|
|
|
925
1274
|
//#endregion
|
|
926
1275
|
//#region src/functions/parsers/parseEnv.ts
|
|
@@ -946,9 +1295,8 @@ const Env = {
|
|
|
946
1295
|
* @returns The specified environment if allowed.
|
|
947
1296
|
*/
|
|
948
1297
|
function parseEnv(data) {
|
|
949
|
-
return
|
|
1298
|
+
return parseZodSchema(zod.z.enum(Env), data, new DataError(data, "INVALID_ENV", "The provided environment type must be one of `test | development | production`"));
|
|
950
1299
|
}
|
|
951
|
-
var parseEnv_default = parseEnv;
|
|
952
1300
|
|
|
953
1301
|
//#endregion
|
|
954
1302
|
//#region src/functions/parsers/parseFilePath.ts
|
|
@@ -964,23 +1312,22 @@ var parseEnv_default = parseEnv;
|
|
|
964
1312
|
* @returns An object representing the different ways the file path can be represented.
|
|
965
1313
|
*/
|
|
966
1314
|
function parseFilePath(filePath) {
|
|
967
|
-
const caughtGroups = filePath.match(RegExp(
|
|
1315
|
+
const caughtGroups = filePath.match(RegExp(FILE_PATH_REGEX));
|
|
968
1316
|
if (!caughtGroups) {
|
|
969
1317
|
if (!(filePath.includes("/") || filePath.includes("\\")) && filePath.includes(".")) return {
|
|
970
1318
|
directory: "",
|
|
971
1319
|
base: filePath,
|
|
972
1320
|
fullPath: filePath
|
|
973
1321
|
};
|
|
974
|
-
throw new
|
|
1322
|
+
throw new DataError({ filePath }, "INVALID_FILE_PATH", "The file path you provided is not valid.");
|
|
975
1323
|
}
|
|
976
|
-
if (!caughtGroups.groups) throw new
|
|
1324
|
+
if (!caughtGroups.groups) throw new DataError({ filePath }, "PARSING_ERROR", "An error occurred while trying to parse the data.");
|
|
977
1325
|
return {
|
|
978
1326
|
directory: caughtGroups.groups.directory,
|
|
979
1327
|
base: caughtGroups.groups.base,
|
|
980
1328
|
fullPath: node_path.default.join(caughtGroups.groups.directory.replaceAll("\\", "/"), caughtGroups.groups.base)
|
|
981
1329
|
};
|
|
982
1330
|
}
|
|
983
|
-
var parseFilePath_default = parseFilePath;
|
|
984
1331
|
|
|
985
1332
|
//#endregion
|
|
986
1333
|
//#region src/functions/parsers/parseFormData.ts
|
|
@@ -1004,7 +1351,6 @@ function parseFormData(formData, dataParser) {
|
|
|
1004
1351
|
if (dataParser) return dataParser(object);
|
|
1005
1352
|
return object;
|
|
1006
1353
|
}
|
|
1007
|
-
var parseFormData_default = parseFormData;
|
|
1008
1354
|
|
|
1009
1355
|
//#endregion
|
|
1010
1356
|
//#region src/functions/parsers/parseVersionType.ts
|
|
@@ -1030,9 +1376,8 @@ const VersionType = {
|
|
|
1030
1376
|
* @returns The given version type if allowed.
|
|
1031
1377
|
*/
|
|
1032
1378
|
function parseVersionType(data) {
|
|
1033
|
-
return
|
|
1379
|
+
return parseZodSchema(zod.default.enum(VersionType), data, new DataError(data, "INVALID_VERSION_TYPE", "The provided version type must be one of `major | minor | patch`"));
|
|
1034
1380
|
}
|
|
1035
|
-
var parseVersionType_default = parseVersionType;
|
|
1036
1381
|
|
|
1037
1382
|
//#endregion
|
|
1038
1383
|
//#region src/functions/parsers/zod/parseZodSchemaAsync.ts
|
|
@@ -1053,9 +1398,8 @@ var parseVersionType_default = parseVersionType;
|
|
|
1053
1398
|
* @returns The parsed data from the Zod schema.
|
|
1054
1399
|
*/
|
|
1055
1400
|
async function parseZodSchemaAsync(schema, data, onError) {
|
|
1056
|
-
return
|
|
1401
|
+
return _parseZodSchema(await schema.safeParseAsync(data), data, onError);
|
|
1057
1402
|
}
|
|
1058
|
-
var parseZodSchemaAsync_default = parseZodSchemaAsync;
|
|
1059
1403
|
|
|
1060
1404
|
//#endregion
|
|
1061
1405
|
//#region src/functions/recursive/deepCopy.ts
|
|
@@ -1084,32 +1428,6 @@ function deepCopy(object) {
|
|
|
1084
1428
|
}
|
|
1085
1429
|
return clonedObject;
|
|
1086
1430
|
}
|
|
1087
|
-
var deepCopy_default = deepCopy;
|
|
1088
|
-
|
|
1089
|
-
//#endregion
|
|
1090
|
-
//#region src/functions/recursive/deepFreeze.ts
|
|
1091
|
-
/**
|
|
1092
|
-
* Deeply freezes an object or array such that all child objects/arrays are also frozen.
|
|
1093
|
-
*
|
|
1094
|
-
* Note that this will also freeze the input itself as well.
|
|
1095
|
-
* If the intent is to create a newly frozen object with a different reference in memory, pass your object through deepCopy first before passing to deepFreeze.
|
|
1096
|
-
*
|
|
1097
|
-
* @category Recursive
|
|
1098
|
-
*
|
|
1099
|
-
* @template ObjectType - The type of the input object.
|
|
1100
|
-
*
|
|
1101
|
-
* @param object - The object to freeze. May also be an array.
|
|
1102
|
-
*
|
|
1103
|
-
* @returns The input object completely frozen.
|
|
1104
|
-
*/
|
|
1105
|
-
function deepFreeze(object) {
|
|
1106
|
-
for (const value of Object.values(object)) {
|
|
1107
|
-
if (typeof value === "function") continue;
|
|
1108
|
-
if (value && typeof value === "object") deepFreeze(value);
|
|
1109
|
-
}
|
|
1110
|
-
return Object.freeze(object);
|
|
1111
|
-
}
|
|
1112
|
-
var deepFreeze_default = deepFreeze;
|
|
1113
1431
|
|
|
1114
1432
|
//#endregion
|
|
1115
1433
|
//#region src/functions/security/encryptWithKey.ts
|
|
@@ -1128,10 +1446,9 @@ async function encryptWithKey(publicKey, plaintextValue) {
|
|
|
1128
1446
|
const encryptedValue = libsodium_wrappers.default.crypto_box_seal(plaintextValue, base64Key);
|
|
1129
1447
|
return libsodium_wrappers.default.to_base64(encryptedValue, libsodium_wrappers.default.base64_variants.ORIGINAL);
|
|
1130
1448
|
} catch {
|
|
1131
|
-
throw new
|
|
1449
|
+
throw new DataError({ publicKey }, "ENCRYPTION_FAILED", "Encryption failed. Please double-check that the given key is a valid base 64 string.");
|
|
1132
1450
|
}
|
|
1133
1451
|
}
|
|
1134
|
-
var encryptWithKey_default = encryptWithKey;
|
|
1135
1452
|
|
|
1136
1453
|
//#endregion
|
|
1137
1454
|
//#region src/functions/security/getPublicAndPrivateKey.ts
|
|
@@ -1149,7 +1466,7 @@ var encryptWithKey_default = encryptWithKey;
|
|
|
1149
1466
|
function getPublicAndPrivateKey(outputFormat) {
|
|
1150
1467
|
const keys = libsodium_wrappers.default.crypto_box_keypair(outputFormat);
|
|
1151
1468
|
if (outputFormat === "uint8array" || outputFormat === void 0) {
|
|
1152
|
-
if (!(keys?.publicKey instanceof Uint8Array && keys?.privateKey instanceof Uint8Array)) throw new
|
|
1469
|
+
if (!(keys?.publicKey instanceof Uint8Array && keys?.privateKey instanceof Uint8Array)) throw new DataError({
|
|
1153
1470
|
publicKey: `<redacted: ${keys?.publicKey?.constructor?.name ?? typeof keys?.publicKey}>`,
|
|
1154
1471
|
privateKey: `<redacted: ${keys?.privateKey?.constructor?.name ?? typeof keys?.privateKey}>`
|
|
1155
1472
|
}, "INVALID_KEY_TYPES", "Expected Uint8Array keypair from libsodium.");
|
|
@@ -1157,7 +1474,6 @@ function getPublicAndPrivateKey(outputFormat) {
|
|
|
1157
1474
|
}
|
|
1158
1475
|
return keys;
|
|
1159
1476
|
}
|
|
1160
|
-
var getPublicAndPrivateKey_default = getPublicAndPrivateKey;
|
|
1161
1477
|
|
|
1162
1478
|
//#endregion
|
|
1163
1479
|
//#region src/functions/stringHelpers/appendSemicolon.ts
|
|
@@ -1178,7 +1494,6 @@ function appendSemicolon(stringToAppendTo) {
|
|
|
1178
1494
|
if (stringWithNoTrailingWhitespace === "") return "";
|
|
1179
1495
|
return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
|
|
1180
1496
|
}
|
|
1181
|
-
var appendSemicolon_default = appendSemicolon;
|
|
1182
1497
|
|
|
1183
1498
|
//#endregion
|
|
1184
1499
|
//#region src/functions/stringHelpers/camelToKebab.ts
|
|
@@ -1218,7 +1533,6 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
|
|
|
1218
1533
|
}
|
|
1219
1534
|
return result;
|
|
1220
1535
|
}
|
|
1221
|
-
var camelToKebab_default = camelToKebab;
|
|
1222
1536
|
|
|
1223
1537
|
//#endregion
|
|
1224
1538
|
//#region src/functions/stringHelpers/kebabToCamel.ts
|
|
@@ -1242,7 +1556,7 @@ function kebabToCamel(string, options) {
|
|
|
1242
1556
|
skip = false;
|
|
1243
1557
|
continue;
|
|
1244
1558
|
}
|
|
1245
|
-
const index =
|
|
1559
|
+
const index = parseIntStrict(stringIndex);
|
|
1246
1560
|
if (index === 0 && options?.startWithUpper) {
|
|
1247
1561
|
outputString += string[index].toUpperCase();
|
|
1248
1562
|
continue;
|
|
@@ -1258,7 +1572,6 @@ function kebabToCamel(string, options) {
|
|
|
1258
1572
|
}
|
|
1259
1573
|
return outputString;
|
|
1260
1574
|
}
|
|
1261
|
-
var kebabToCamel_default = kebabToCamel;
|
|
1262
1575
|
|
|
1263
1576
|
//#endregion
|
|
1264
1577
|
//#region src/functions/stringHelpers/normalizeImportPath.ts
|
|
@@ -1296,7 +1609,6 @@ function normalizeImportPath(importPath) {
|
|
|
1296
1609
|
* @returns The import path normalised.
|
|
1297
1610
|
*/
|
|
1298
1611
|
const normaliseImportPath = normalizeImportPath;
|
|
1299
|
-
var normalizeImportPath_default = normalizeImportPath;
|
|
1300
1612
|
|
|
1301
1613
|
//#endregion
|
|
1302
1614
|
//#region src/functions/stringHelpers/truncate.ts
|
|
@@ -1313,190 +1625,6 @@ var normalizeImportPath_default = normalizeImportPath;
|
|
|
1313
1625
|
function truncate(stringToTruncate, maxLength = 5) {
|
|
1314
1626
|
return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
|
|
1315
1627
|
}
|
|
1316
|
-
var truncate_default = truncate;
|
|
1317
|
-
|
|
1318
|
-
//#endregion
|
|
1319
|
-
//#region src/functions/taggedTemplate/createTemplateStringsArray.ts
|
|
1320
|
-
/**
|
|
1321
|
-
* Creates a template strings array given a regular array of strings
|
|
1322
|
-
*
|
|
1323
|
-
* @category Tagged Template
|
|
1324
|
-
*
|
|
1325
|
-
* @param strings - The array of strings.
|
|
1326
|
-
*
|
|
1327
|
-
* @returns A template strings array that can be passed as the first argument of any tagged template function.
|
|
1328
|
-
*/
|
|
1329
|
-
function createTemplateStringsArray(strings) {
|
|
1330
|
-
return deepFreeze_default(Object.assign([...strings], { raw: [...strings] }));
|
|
1331
|
-
}
|
|
1332
|
-
var createTemplateStringsArray_default = createTemplateStringsArray;
|
|
1333
|
-
|
|
1334
|
-
//#endregion
|
|
1335
|
-
//#region src/functions/taggedTemplate/getInterpolations.ts
|
|
1336
|
-
/**
|
|
1337
|
-
* Gets the strings and interpolations separately from a template string.
|
|
1338
|
-
* You can pass a template string directly by doing:
|
|
1339
|
-
*
|
|
1340
|
-
* ```typescript
|
|
1341
|
-
* getInterpolations`Template string here`.
|
|
1342
|
-
* ```
|
|
1343
|
-
*
|
|
1344
|
-
* @category Tagged Template
|
|
1345
|
-
*
|
|
1346
|
-
* @param strings - The strings from the template to process.
|
|
1347
|
-
* @param interpolations - An array of all interpolations from the template.
|
|
1348
|
-
*
|
|
1349
|
-
* @returns A tuple where the first item is the strings from the template, and the second is the interpolations.
|
|
1350
|
-
*/
|
|
1351
|
-
function getInterpolations(strings, ...interpolations) {
|
|
1352
|
-
return [strings, interpolations];
|
|
1353
|
-
}
|
|
1354
|
-
var getInterpolations_default = getInterpolations;
|
|
1355
|
-
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region src/functions/taggedTemplate/interpolate.ts
|
|
1358
|
-
/**
|
|
1359
|
-
* Returns the result of interpolating a template string when given the strings and interpolations separately.
|
|
1360
|
-
*
|
|
1361
|
-
* You can pass a template string directly by doing:
|
|
1362
|
-
*
|
|
1363
|
-
* ```
|
|
1364
|
-
* interpolate`Template string here`;
|
|
1365
|
-
* ```
|
|
1366
|
-
*
|
|
1367
|
-
* In this case, it will be functionally the same as if you just wrote the template string by itself.
|
|
1368
|
-
*
|
|
1369
|
-
* @category Tagged Template
|
|
1370
|
-
*
|
|
1371
|
-
* @param strings - The strings from the template to process.
|
|
1372
|
-
* @param interpolations - An array of all interpolations from the template.
|
|
1373
|
-
*
|
|
1374
|
-
* @returns A new string with the strings and interpolations from the template applied.
|
|
1375
|
-
*/
|
|
1376
|
-
function interpolate(strings, ...interpolations) {
|
|
1377
|
-
let result = "";
|
|
1378
|
-
for (const [string, interpolation = ""] of paralleliseArrays_default(strings, interpolations)) result += string + interpolation;
|
|
1379
|
-
return result;
|
|
1380
|
-
}
|
|
1381
|
-
var interpolate_default = interpolate;
|
|
1382
|
-
|
|
1383
|
-
//#endregion
|
|
1384
|
-
//#region src/functions/taggedTemplate/interpolateObjects.ts
|
|
1385
|
-
/**
|
|
1386
|
-
* Returns the result of interpolating a template string, also stringifying objects.
|
|
1387
|
-
*
|
|
1388
|
-
* You can pass a template string directly by doing:
|
|
1389
|
-
*
|
|
1390
|
-
* ```typescript
|
|
1391
|
-
* interpolateObjects`Template string here ${{ my: "object" }}`.
|
|
1392
|
-
* ```
|
|
1393
|
-
*
|
|
1394
|
-
* @category Tagged Template
|
|
1395
|
-
*
|
|
1396
|
-
* @param strings - The strings from the template to process.
|
|
1397
|
-
* @param interpolations - An array of all interpolations from the template.
|
|
1398
|
-
*
|
|
1399
|
-
* @returns A new string with the strings and interpolations from the template applied, with objects stringified.
|
|
1400
|
-
*/
|
|
1401
|
-
function interpolateObjects(strings, ...interpolations) {
|
|
1402
|
-
let result = "";
|
|
1403
|
-
for (let i = 0; i < strings.length; i++) {
|
|
1404
|
-
result += strings[i];
|
|
1405
|
-
if (i !== strings.length - 1) result += interpolations[i] && typeof interpolations[i] === "object" ? JSON.stringify(interpolations[i]) : interpolations[i];
|
|
1406
|
-
}
|
|
1407
|
-
return result;
|
|
1408
|
-
}
|
|
1409
|
-
var interpolateObjects_default = interpolateObjects;
|
|
1410
|
-
|
|
1411
|
-
//#endregion
|
|
1412
|
-
//#region src/functions/taggedTemplate/normaliseIndents.ts
|
|
1413
|
-
function calculateTabSize(line, whitespaceLength) {
|
|
1414
|
-
const potentialWhitespacePart = line.slice(0, whitespaceLength);
|
|
1415
|
-
const trimmedString = line.trimStart();
|
|
1416
|
-
if (potentialWhitespacePart.trim() !== "") return 0;
|
|
1417
|
-
const tabSize = line.length - (trimmedString.length + whitespaceLength);
|
|
1418
|
-
return tabSize < 0 ? 0 : tabSize;
|
|
1419
|
-
}
|
|
1420
|
-
function getWhitespaceLength(lines) {
|
|
1421
|
-
const [firstNonEmptyLine] = lines.filter((line) => {
|
|
1422
|
-
return line.trim() !== "";
|
|
1423
|
-
});
|
|
1424
|
-
return firstNonEmptyLine.length - firstNonEmptyLine.trimStart().length;
|
|
1425
|
-
}
|
|
1426
|
-
function reduceLines(lines, { preserveTabs = true }) {
|
|
1427
|
-
const slicedLines = lines.slice(1);
|
|
1428
|
-
const isFirstLineEmpty = lines[0].trim() === "";
|
|
1429
|
-
const whitespaceLength = getWhitespaceLength(isFirstLineEmpty ? lines : slicedLines);
|
|
1430
|
-
return (isFirstLineEmpty ? slicedLines : lines).map((line) => {
|
|
1431
|
-
const tabSize = calculateTabSize(line, whitespaceLength);
|
|
1432
|
-
return (preserveTabs ? fillArray_default(() => {
|
|
1433
|
-
return " ";
|
|
1434
|
-
}, tabSize).join("") : "") + line.trimStart();
|
|
1435
|
-
}).join("\n");
|
|
1436
|
-
}
|
|
1437
|
-
/**
|
|
1438
|
-
* Applies any options if provided, then removes any extraneous indents from a multi-line template string.
|
|
1439
|
-
*
|
|
1440
|
-
* You can pass a template string directly by doing:
|
|
1441
|
-
*
|
|
1442
|
-
* ```typescript
|
|
1443
|
-
* normaliseIndents`Template string here
|
|
1444
|
-
* with a new line
|
|
1445
|
-
* and another new line`.
|
|
1446
|
-
* ```
|
|
1447
|
-
*
|
|
1448
|
-
* You may also pass the options first, then invoke the resulting function with a template string:
|
|
1449
|
-
*
|
|
1450
|
-
* ```typescript
|
|
1451
|
-
* normaliseIndents({ preserveTabs: false })`Template string here
|
|
1452
|
-
* with a new line
|
|
1453
|
-
* and another new line`.
|
|
1454
|
-
* ```
|
|
1455
|
-
*
|
|
1456
|
-
*@category Tagged Template
|
|
1457
|
-
*
|
|
1458
|
-
* @param first - The strings from the template to process, or the options to apply.
|
|
1459
|
-
* @param args - An array of all interpolations from the template.
|
|
1460
|
-
*
|
|
1461
|
-
* @returns An additional function to invoke, or a new string with the strings and interpolations from the template applied, and extraneous indents removed.
|
|
1462
|
-
*/
|
|
1463
|
-
function normaliseIndents(first, ...args) {
|
|
1464
|
-
if (typeof first === "object" && first !== null && !Array.isArray(first)) {
|
|
1465
|
-
const options = first;
|
|
1466
|
-
return (strings, ...interpolations) => {
|
|
1467
|
-
return normaliseIndents(strings, ...interpolations, options);
|
|
1468
|
-
};
|
|
1469
|
-
}
|
|
1470
|
-
const strings = first;
|
|
1471
|
-
const options = typeof args[args.length - 1] === "object" && !Array.isArray(args[args.length - 1]) ? args.pop() : {};
|
|
1472
|
-
return reduceLines(interpolate_default(strings, ...[...args]).split("\n"), options);
|
|
1473
|
-
}
|
|
1474
|
-
/**
|
|
1475
|
-
* Applies any options if provided, then removes any extraneous indents from a multi-line template string.
|
|
1476
|
-
*
|
|
1477
|
-
* You can pass a template string directly by doing:
|
|
1478
|
-
*
|
|
1479
|
-
* ```typescript
|
|
1480
|
-
* normalizeIndents`Template string here
|
|
1481
|
-
* with a new line
|
|
1482
|
-
* and another new line`.
|
|
1483
|
-
* ```
|
|
1484
|
-
*
|
|
1485
|
-
* You may also pass the options first, then invoke the resulting function with a template string:
|
|
1486
|
-
*
|
|
1487
|
-
* ```typescript
|
|
1488
|
-
* normalizeIndents({ preserveTabs: false })`Template string here
|
|
1489
|
-
* with a new line
|
|
1490
|
-
* and another new line`.
|
|
1491
|
-
* ```
|
|
1492
|
-
*
|
|
1493
|
-
* @param first - The strings from the template to process, or the options to apply.
|
|
1494
|
-
* @param args - An array of all interpolations from the template.
|
|
1495
|
-
*
|
|
1496
|
-
* @returns An additional function to invoke, or a new string with the strings and interpolations from the template applied, and extraneous indents removed.
|
|
1497
|
-
*/
|
|
1498
|
-
const normalizeIndents = normaliseIndents;
|
|
1499
|
-
var normaliseIndents_default = normaliseIndents;
|
|
1500
1628
|
|
|
1501
1629
|
//#endregion
|
|
1502
1630
|
//#region src/functions/versioning/parseVersion.ts
|
|
@@ -1515,11 +1643,10 @@ var normaliseIndents_default = normaliseIndents;
|
|
|
1515
1643
|
* @returns The validated version number, prefixed with `v` if it was not already.
|
|
1516
1644
|
*/
|
|
1517
1645
|
function parseVersion(input, options) {
|
|
1518
|
-
if (!RegExp(
|
|
1646
|
+
if (!RegExp(VERSION_NUMBER_REGEX).test(input)) throw new DataError(input, "INVALID_VERSION", `"${input}" is not a valid version number. Version numbers must be of the format "X.Y.Z" or "vX.Y.Z", where X, Y, and Z are non-negative integers.`);
|
|
1519
1647
|
if (options?.omitPrefix) return input.startsWith("v") ? input.slice(1) : input;
|
|
1520
1648
|
return input.startsWith("v") ? input : `v${input}`;
|
|
1521
1649
|
}
|
|
1522
|
-
var parseVersion_default = parseVersion;
|
|
1523
1650
|
|
|
1524
1651
|
//#endregion
|
|
1525
1652
|
//#region src/functions/versioning/getIndividualVersionNumbers.ts
|
|
@@ -1538,11 +1665,10 @@ var parseVersion_default = parseVersion;
|
|
|
1538
1665
|
* @returns A tuple of three numbers indicating `[major, minor, patch]`.
|
|
1539
1666
|
*/
|
|
1540
1667
|
function getIndividualVersionNumbers(version) {
|
|
1541
|
-
return
|
|
1542
|
-
return
|
|
1668
|
+
return parseVersion(version, { omitPrefix: true }).split(".").map((versionNumber) => {
|
|
1669
|
+
return parseIntStrict(versionNumber);
|
|
1543
1670
|
});
|
|
1544
1671
|
}
|
|
1545
|
-
var getIndividualVersionNumbers_default = getIndividualVersionNumbers;
|
|
1546
1672
|
|
|
1547
1673
|
//#endregion
|
|
1548
1674
|
//#region src/functions/versioning/determineVersionType.ts
|
|
@@ -1556,12 +1682,11 @@ var getIndividualVersionNumbers_default = getIndividualVersionNumbers;
|
|
|
1556
1682
|
* @returns Either `"major"`, `"minor"`, or `"patch"`, depending on the version type.
|
|
1557
1683
|
*/
|
|
1558
1684
|
function determineVersionType(version) {
|
|
1559
|
-
const [_major, minor, patch] =
|
|
1685
|
+
const [_major, minor, patch] = getIndividualVersionNumbers(version);
|
|
1560
1686
|
if (minor === 0 && patch === 0) return "major";
|
|
1561
1687
|
if (patch === 0) return "minor";
|
|
1562
1688
|
return "patch";
|
|
1563
1689
|
}
|
|
1564
|
-
var determineVersionType_default = determineVersionType;
|
|
1565
1690
|
|
|
1566
1691
|
//#endregion
|
|
1567
1692
|
//#region src/functions/versioning/incrementVersion.ts
|
|
@@ -1580,72 +1705,74 @@ var determineVersionType_default = determineVersionType;
|
|
|
1580
1705
|
* @returns A new string representing the version with the increment applied.
|
|
1581
1706
|
*/
|
|
1582
1707
|
function incrementVersion(version, incrementType, options) {
|
|
1583
|
-
const [major, minor, patch] =
|
|
1708
|
+
const [major, minor, patch] = getIndividualVersionNumbers(version);
|
|
1584
1709
|
const newVersion = {
|
|
1585
1710
|
major: `${major + 1}.0.0`,
|
|
1586
1711
|
minor: `${major}.${minor + 1}.0`,
|
|
1587
1712
|
patch: `${major}.${minor}.${patch + 1}`
|
|
1588
1713
|
}[incrementType];
|
|
1589
|
-
return
|
|
1714
|
+
return parseVersion(newVersion, { omitPrefix: options?.omitPrefix });
|
|
1590
1715
|
}
|
|
1591
|
-
var incrementVersion_default = incrementVersion;
|
|
1592
1716
|
|
|
1593
1717
|
//#endregion
|
|
1594
|
-
exports.APIError =
|
|
1595
|
-
exports.DataError =
|
|
1718
|
+
exports.APIError = APIError;
|
|
1719
|
+
exports.DataError = DataError;
|
|
1596
1720
|
exports.Env = Env;
|
|
1597
|
-
exports.FILE_PATH_REGEX =
|
|
1598
|
-
exports.NAMESPACE_EXPORT_REGEX =
|
|
1599
|
-
exports.VERSION_NUMBER_REGEX =
|
|
1600
|
-
exports.VersionNumber =
|
|
1721
|
+
exports.FILE_PATH_REGEX = FILE_PATH_REGEX;
|
|
1722
|
+
exports.NAMESPACE_EXPORT_REGEX = NAMESPACE_EXPORT_REGEX;
|
|
1723
|
+
exports.VERSION_NUMBER_REGEX = VERSION_NUMBER_REGEX;
|
|
1724
|
+
exports.VersionNumber = VersionNumber;
|
|
1601
1725
|
exports.VersionType = VersionType;
|
|
1602
|
-
exports.addDaysToDate =
|
|
1603
|
-
exports.appendSemicolon =
|
|
1604
|
-
exports.camelToKebab =
|
|
1605
|
-
exports.convertFileToBase64 =
|
|
1606
|
-
exports.createFormData =
|
|
1607
|
-
exports.createTemplateStringsArray =
|
|
1608
|
-
exports.deepCopy =
|
|
1609
|
-
exports.deepFreeze =
|
|
1610
|
-
exports.determineVersionType =
|
|
1611
|
-
exports.encryptWithKey =
|
|
1612
|
-
exports.fillArray =
|
|
1613
|
-
exports.formatDateAndTime =
|
|
1614
|
-
exports.getIndividualVersionNumbers =
|
|
1615
|
-
exports.getInterpolations =
|
|
1616
|
-
exports.getPublicAndPrivateKey =
|
|
1617
|
-
exports.getRandomNumber =
|
|
1618
|
-
exports.getRecordKeys =
|
|
1726
|
+
exports.addDaysToDate = addDaysToDate;
|
|
1727
|
+
exports.appendSemicolon = appendSemicolon;
|
|
1728
|
+
exports.camelToKebab = camelToKebab;
|
|
1729
|
+
exports.convertFileToBase64 = convertFileToBase64;
|
|
1730
|
+
exports.createFormData = createFormData;
|
|
1731
|
+
exports.createTemplateStringsArray = createTemplateStringsArray;
|
|
1732
|
+
exports.deepCopy = deepCopy;
|
|
1733
|
+
exports.deepFreeze = deepFreeze;
|
|
1734
|
+
exports.determineVersionType = determineVersionType;
|
|
1735
|
+
exports.encryptWithKey = encryptWithKey;
|
|
1736
|
+
exports.fillArray = fillArray;
|
|
1737
|
+
exports.formatDateAndTime = formatDateAndTime;
|
|
1738
|
+
exports.getIndividualVersionNumbers = getIndividualVersionNumbers;
|
|
1739
|
+
exports.getInterpolations = getInterpolations;
|
|
1740
|
+
exports.getPublicAndPrivateKey = getPublicAndPrivateKey;
|
|
1741
|
+
exports.getRandomNumber = getRandomNumber;
|
|
1742
|
+
exports.getRecordKeys = getRecordKeys;
|
|
1743
|
+
exports.getStringsAndInterpolations = getStringsAndInterpolations;
|
|
1619
1744
|
exports.httpErrorCodeLookup = httpErrorCodeLookup;
|
|
1620
|
-
exports.incrementVersion =
|
|
1621
|
-
exports.interpolate =
|
|
1622
|
-
exports.interpolateObjects =
|
|
1623
|
-
exports.isAnniversary =
|
|
1624
|
-
exports.isLeapYear =
|
|
1625
|
-
exports.isMonthlyMultiple =
|
|
1626
|
-
exports.isOrdered =
|
|
1627
|
-
exports.isSameDate =
|
|
1628
|
-
exports.
|
|
1745
|
+
exports.incrementVersion = incrementVersion;
|
|
1746
|
+
exports.interpolate = interpolate;
|
|
1747
|
+
exports.interpolateObjects = interpolateObjects;
|
|
1748
|
+
exports.isAnniversary = isAnniversary;
|
|
1749
|
+
exports.isLeapYear = isLeapYear;
|
|
1750
|
+
exports.isMonthlyMultiple = isMonthlyMultiple;
|
|
1751
|
+
exports.isOrdered = isOrdered;
|
|
1752
|
+
exports.isSameDate = isSameDate;
|
|
1753
|
+
exports.isTemplateStringsArray = isTemplateStringsArray;
|
|
1754
|
+
exports.kebabToCamel = kebabToCamel;
|
|
1629
1755
|
exports.normaliseImportPath = normaliseImportPath;
|
|
1630
|
-
exports.normaliseIndents =
|
|
1631
|
-
exports.normalizeImportPath =
|
|
1756
|
+
exports.normaliseIndents = normaliseIndents;
|
|
1757
|
+
exports.normalizeImportPath = normalizeImportPath;
|
|
1632
1758
|
exports.normalizeIndents = normalizeIndents;
|
|
1633
|
-
exports.omitProperties =
|
|
1634
|
-
exports.paralleliseArrays =
|
|
1635
|
-
exports.parseBoolean =
|
|
1636
|
-
exports.parseEnv =
|
|
1637
|
-
exports.parseFilePath =
|
|
1638
|
-
exports.parseFormData =
|
|
1639
|
-
exports.parseIntStrict =
|
|
1640
|
-
exports.parseVersion =
|
|
1641
|
-
exports.parseVersionType =
|
|
1642
|
-
exports.parseZodSchema =
|
|
1643
|
-
exports.parseZodSchemaAsync =
|
|
1644
|
-
exports.randomiseArray =
|
|
1645
|
-
exports.range =
|
|
1646
|
-
exports.removeDuplicates =
|
|
1647
|
-
exports.removeUndefinedFromObject =
|
|
1648
|
-
exports.
|
|
1649
|
-
exports.
|
|
1650
|
-
exports.
|
|
1651
|
-
exports.
|
|
1759
|
+
exports.omitProperties = omitProperties;
|
|
1760
|
+
exports.paralleliseArrays = paralleliseArrays;
|
|
1761
|
+
exports.parseBoolean = parseBoolean;
|
|
1762
|
+
exports.parseEnv = parseEnv;
|
|
1763
|
+
exports.parseFilePath = parseFilePath;
|
|
1764
|
+
exports.parseFormData = parseFormData;
|
|
1765
|
+
exports.parseIntStrict = parseIntStrict;
|
|
1766
|
+
exports.parseVersion = parseVersion;
|
|
1767
|
+
exports.parseVersionType = parseVersionType;
|
|
1768
|
+
exports.parseZodSchema = parseZodSchema;
|
|
1769
|
+
exports.parseZodSchemaAsync = parseZodSchemaAsync;
|
|
1770
|
+
exports.randomiseArray = randomiseArray;
|
|
1771
|
+
exports.range = range;
|
|
1772
|
+
exports.removeDuplicates = removeDuplicates;
|
|
1773
|
+
exports.removeUndefinedFromObject = removeUndefinedFromObject;
|
|
1774
|
+
exports.sayHello = sayHello;
|
|
1775
|
+
exports.stringListToArray = stringListToArray;
|
|
1776
|
+
exports.stringifyDotenv = stringifyDotenv;
|
|
1777
|
+
exports.truncate = truncate;
|
|
1778
|
+
exports.wait = wait;
|