@alextheman/utility 4.10.2 → 4.12.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
@@ -27,11 +27,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  //#endregion
28
28
  let zod = require("zod");
29
29
  zod = __toESM(zod);
30
- let libsodium_wrappers = require("libsodium-wrappers");
31
- libsodium_wrappers = __toESM(libsodium_wrappers);
32
30
  let node_path = require("node:path");
33
31
  node_path = __toESM(node_path);
32
+ let libsodium_wrappers = require("libsodium-wrappers");
33
+ libsodium_wrappers = __toESM(libsodium_wrappers);
34
34
 
35
+ //#region src/constants/FILE_PATH_REGEX.ts
36
+ const FILE_PATH_REGEX = String.raw`^(?<directory>.+)[\/\\](?<base>[^\/\\]+)$`;
37
+ var FILE_PATH_REGEX_default = FILE_PATH_REGEX;
38
+
39
+ //#endregion
35
40
  //#region src/constants/NAMESPACE_EXPORT_REGEX.ts
36
41
  const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
37
42
  var NAMESPACE_EXPORT_REGEX_default = NAMESPACE_EXPORT_REGEX;
@@ -653,17 +658,17 @@ function createFormData(data, options = {
653
658
  default: throw new TypeError("SLOPPY_PURE_JAVASCRIPT_USER_ERROR");
654
659
  }
655
660
  }
656
- function resolveNullables(key, value, options$1) {
657
- if (options$1.nullableResolution) {
658
- resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.nullableResolution));
661
+ function resolveNullables(key, value, options) {
662
+ if (options.nullableResolution) {
663
+ resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options.nullableResolution));
659
664
  return;
660
665
  }
661
- if (options$1.undefinedResolution || options$1.nullResolution) {
662
- if (data[key] === void 0 && options$1.undefinedResolution) {
663
- resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.undefinedResolution));
666
+ if (options.undefinedResolution || options.nullResolution) {
667
+ if (data[key] === void 0 && options.undefinedResolution) {
668
+ resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options.undefinedResolution));
664
669
  return;
665
670
  }
666
- if (data[key] === null && options$1.nullResolution) resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.nullResolution));
671
+ if (data[key] === null && options.nullResolution) resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options.nullResolution));
667
672
  }
668
673
  }
669
674
  const entries = Object.entries(data);
@@ -884,8 +889,8 @@ function _parseZodSchema(parsedResult, data, onError) {
884
889
  }
885
890
  throw new DataError_default(data, Object.entries(allErrorCodes).toSorted(([_, firstCount], [__, secondCount]) => {
886
891
  return secondCount - firstCount;
887
- }).map(([code, count], _, allErrorCodes$1) => {
888
- return allErrorCodes$1.length === 1 && count === 1 ? code : `${code}×${count}`;
892
+ }).map(([code, count], _, allErrorCodes) => {
893
+ return allErrorCodes.length === 1 && count === 1 ? code : `${code}×${count}`;
889
894
  }).join(","), `\n\n${zod.default.prettifyError(parsedResult.error)}\n`);
890
895
  }
891
896
  return parsedResult.data;
@@ -945,6 +950,38 @@ function parseEnv(data) {
945
950
  }
946
951
  var parseEnv_default = parseEnv;
947
952
 
953
+ //#endregion
954
+ //#region src/functions/parsers/parseFilePath.ts
955
+ /**
956
+ * Takes a file path string and parses it into the directory part, the base part, and the full path.
957
+ *
958
+ * @category Parsers
959
+ *
960
+ * @param filePath - The file path to parse.
961
+ *
962
+ * @throws {DataError} If the file path is invalid.
963
+ *
964
+ * @returns An object representing the different ways the file path can be represented.
965
+ */
966
+ function parseFilePath(filePath) {
967
+ const caughtGroups = filePath.match(RegExp(FILE_PATH_REGEX_default));
968
+ if (!caughtGroups) {
969
+ if (!(filePath.includes("/") || filePath.includes("\\")) && filePath.includes(".")) return {
970
+ directory: "",
971
+ base: filePath,
972
+ fullPath: filePath
973
+ };
974
+ throw new DataError_default({ filePath }, "INVALID_FILE_PATH", "The file path you provided is not valid.");
975
+ }
976
+ if (!caughtGroups.groups) throw new DataError_default({ filePath }, "PARSING_ERROR", "An error occurred while trying to parse the data.");
977
+ return {
978
+ directory: caughtGroups.groups.directory,
979
+ base: caughtGroups.groups.base,
980
+ fullPath: node_path.default.join(caughtGroups.groups.directory.replaceAll("\\", "/"), caughtGroups.groups.base)
981
+ };
982
+ }
983
+ var parseFilePath_default = parseFilePath;
984
+
948
985
  //#endregion
949
986
  //#region src/functions/parsers/parseFormData.ts
950
987
  /**
@@ -1096,6 +1133,32 @@ async function encryptWithKey(publicKey, plaintextValue) {
1096
1133
  }
1097
1134
  var encryptWithKey_default = encryptWithKey;
1098
1135
 
1136
+ //#endregion
1137
+ //#region src/functions/security/getPublicAndPrivateKey.ts
1138
+ /**
1139
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
1140
+ *
1141
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
1142
+ *
1143
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
1144
+ *
1145
+ * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
1146
+ *
1147
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
1148
+ */
1149
+ function getPublicAndPrivateKey(outputFormat) {
1150
+ const keys = libsodium_wrappers.default.crypto_box_keypair(outputFormat);
1151
+ if (outputFormat === "uint8array" || outputFormat === void 0) {
1152
+ if (!(keys?.publicKey instanceof Uint8Array && keys?.privateKey instanceof Uint8Array)) throw new DataError_default({
1153
+ publicKey: `<redacted: ${keys?.publicKey?.constructor?.name ?? typeof keys?.publicKey}>`,
1154
+ privateKey: `<redacted: ${keys?.privateKey?.constructor?.name ?? typeof keys?.privateKey}>`
1155
+ }, "INVALID_KEY_TYPES", "Expected Uint8Array keypair from libsodium.");
1156
+ return keys;
1157
+ }
1158
+ return keys;
1159
+ }
1160
+ var getPublicAndPrivateKey_default = getPublicAndPrivateKey;
1161
+
1099
1162
  //#endregion
1100
1163
  //#region src/functions/stringHelpers/appendSemicolon.ts
1101
1164
  /**
@@ -1143,8 +1206,8 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
1143
1206
  result += sequenceOfCapitals.toLowerCase();
1144
1207
  } else {
1145
1208
  if (result) result += "-";
1146
- result += sequenceOfCapitals.split("").map((character$1) => {
1147
- return character$1.toLowerCase();
1209
+ result += sequenceOfCapitals.split("").map((character) => {
1210
+ return character.toLowerCase();
1148
1211
  }).join("-");
1149
1212
  }
1150
1213
  outerIndex = innerIndex;
@@ -1399,9 +1462,9 @@ function reduceLines(lines, { preserveTabs = true }) {
1399
1462
  */
1400
1463
  function normaliseIndents(first, ...args) {
1401
1464
  if (typeof first === "object" && first !== null && !Array.isArray(first)) {
1402
- const options$1 = first;
1403
- return (strings$1, ...interpolations) => {
1404
- return normaliseIndents(strings$1, ...interpolations, options$1);
1465
+ const options = first;
1466
+ return (strings, ...interpolations) => {
1467
+ return normaliseIndents(strings, ...interpolations, options);
1405
1468
  };
1406
1469
  }
1407
1470
  const strings = first;
@@ -1531,6 +1594,7 @@ var incrementVersion_default = incrementVersion;
1531
1594
  exports.APIError = APIError_default;
1532
1595
  exports.DataError = DataError_default;
1533
1596
  exports.Env = Env;
1597
+ exports.FILE_PATH_REGEX = FILE_PATH_REGEX_default;
1534
1598
  exports.NAMESPACE_EXPORT_REGEX = NAMESPACE_EXPORT_REGEX_default;
1535
1599
  exports.VERSION_NUMBER_REGEX = VERSION_NUMBER_REGEX_default;
1536
1600
  exports.VersionNumber = VersionNumber_default;
@@ -1549,6 +1613,7 @@ exports.fillArray = fillArray_default;
1549
1613
  exports.formatDateAndTime = formatDateAndTime_default;
1550
1614
  exports.getIndividualVersionNumbers = getIndividualVersionNumbers_default;
1551
1615
  exports.getInterpolations = getInterpolations_default;
1616
+ exports.getPublicAndPrivateKey = getPublicAndPrivateKey_default;
1552
1617
  exports.getRandomNumber = getRandomNumber_default;
1553
1618
  exports.getRecordKeys = getRecordKeys_default;
1554
1619
  exports.httpErrorCodeLookup = httpErrorCodeLookup;
@@ -1569,6 +1634,7 @@ exports.omitProperties = omitProperties_default;
1569
1634
  exports.paralleliseArrays = paralleliseArrays_default;
1570
1635
  exports.parseBoolean = parseBoolean_default;
1571
1636
  exports.parseEnv = parseEnv_default;
1637
+ exports.parseFilePath = parseFilePath_default;
1572
1638
  exports.parseFormData = parseFormData_default;
1573
1639
  exports.parseIntStrict = parseIntStrict_default;
1574
1640
  exports.parseVersion = parseVersion_default;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { DotenvParseOutput } from "dotenv";
2
2
  import { ZodError, ZodType, z } from "zod";
3
+ import sodium from "libsodium-wrappers";
3
4
 
5
+ //#region src/constants/FILE_PATH_REGEX.d.ts
6
+ declare const FILE_PATH_REGEX: string;
7
+ //#endregion
4
8
  //#region src/constants/NAMESPACE_EXPORT_REGEX.d.ts
5
9
  declare const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
6
10
  //#endregion
@@ -341,6 +345,9 @@ declare class VersionNumber {
341
345
  */
342
346
  type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
343
347
  //#endregion
348
+ //#region src/types/CallReturnType.d.ts
349
+ type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) => infer Return) ? Return : never;
350
+ //#endregion
344
351
  //#region src/types/RecordKey.d.ts
345
352
  /**
346
353
  * Represents the native Record's possible key type.
@@ -410,9 +417,9 @@ type FormDataArrayResolutionStrategy = "stringify" | "multiple";
410
417
  *
411
418
  * @template Key - The type of the key of the input record.
412
419
  */
413
- interface CreateFormDataOptionsBase<Key$1 extends RecordKey> {
420
+ interface CreateFormDataOptionsBase<Key extends RecordKey> {
414
421
  /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
415
- arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key$1, FormDataArrayResolutionStrategy>>;
422
+ arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
416
423
  }
417
424
  /**
418
425
  * Options for resolving form data when it may be undefined or null, but not both.
@@ -421,11 +428,11 @@ interface CreateFormDataOptionsBase<Key$1 extends RecordKey> {
421
428
  *
422
429
  * @template Key - The type of the key of the input record.
423
430
  */
424
- interface CreateFormDataOptionsUndefinedOrNullResolution<Key$1 extends RecordKey> extends CreateFormDataOptionsBase<Key$1> {
431
+ interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
425
432
  /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
426
- undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key$1, FormDataNullableResolutionStrategy>>;
433
+ undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
427
434
  /** How to resolve null data (May either stringify to 'null', resolve to an empty string, or omit entirely). */
428
- nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key$1, FormDataNullableResolutionStrategy>>;
435
+ nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
429
436
  /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
430
437
  nullableResolution?: never;
431
438
  }
@@ -436,13 +443,13 @@ interface CreateFormDataOptionsUndefinedOrNullResolution<Key$1 extends RecordKey
436
443
  *
437
444
  * @template Key - The type of the key of the input record.
438
445
  */
439
- interface CreateFormDataOptionsNullableResolution<Key$1 extends RecordKey> extends CreateFormDataOptionsBase<Key$1> {
446
+ interface CreateFormDataOptionsNullableResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
440
447
  /** @note This must not be provided at the same time as nullableResolution. */
441
448
  undefinedResolution?: never;
442
449
  /** @note This must not be provided at the same time as nullableResolution. */
443
450
  nullResolution?: never;
444
451
  /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
445
- nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key$1, FormDataNullableResolutionStrategy>>;
452
+ nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
446
453
  }
447
454
  /**
448
455
  * Options for resolving form data.
@@ -451,7 +458,7 @@ interface CreateFormDataOptionsNullableResolution<Key$1 extends RecordKey> exten
451
458
  *
452
459
  * @template Key - The type of the key of the input record.
453
460
  */
454
- type CreateFormDataOptions<Key$1 extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key$1> | CreateFormDataOptionsNullableResolution<Key$1>;
461
+ type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
455
462
  /**
456
463
  * Creates FormData from a given object, resolving non-string types as appropriate.
457
464
  *
@@ -628,6 +635,28 @@ type Env = CreateEnumType<typeof Env>;
628
635
  */
629
636
  declare function parseEnv(data: unknown): Env;
630
637
  //#endregion
638
+ //#region src/functions/parsers/parseFilePath.d.ts
639
+ interface FilePathData {
640
+ /** The file path without the final part. */
641
+ directory: string;
642
+ /** The final part of the file path. */
643
+ base: string;
644
+ /** The full file path, normalised. */
645
+ fullPath: string;
646
+ }
647
+ /**
648
+ * Takes a file path string and parses it into the directory part, the base part, and the full path.
649
+ *
650
+ * @category Parsers
651
+ *
652
+ * @param filePath - The file path to parse.
653
+ *
654
+ * @throws {DataError} If the file path is invalid.
655
+ *
656
+ * @returns An object representing the different ways the file path can be represented.
657
+ */
658
+ declare function parseFilePath(filePath: string): FilePathData;
659
+ //#endregion
631
660
  //#region src/functions/parsers/parseFormData.d.ts
632
661
  /**
633
662
  * Returns a parsed object given FormData and a data parser function to call on the resulting object.
@@ -771,6 +800,56 @@ declare function deepFreeze<ObjectType extends object>(object: ObjectType): Read
771
800
  */
772
801
  declare function encryptWithKey(publicKey: string, plaintextValue: string): Promise<string>;
773
802
  //#endregion
803
+ //#region src/functions/security/getPublicAndPrivateKey.d.ts
804
+ interface PublicAndPrivateKey<KeyType extends Uint8Array | string> {
805
+ /** The generated public key from libsodium */
806
+ publicKey: KeyType;
807
+ /** The generated private key from libsodium */
808
+ privateKey: KeyType;
809
+ /** The key type from libsodium */
810
+ keyType: ReturnType<typeof sodium.crypto_box_keypair>["keyType"];
811
+ }
812
+ /**
813
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
814
+ *
815
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
816
+ *
817
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
818
+ *
819
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
820
+ *
821
+ * Because you have not provided an `outputFormat`, the keys will be typed as `Uint8Array`.
822
+ */
823
+ declare function getPublicAndPrivateKey(): PublicAndPrivateKey<Uint8Array>;
824
+ /**
825
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
826
+ *
827
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
828
+ *
829
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
830
+ *
831
+ * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
832
+ *
833
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
834
+ *
835
+ * Because you provided an `outputFormat` of `uint8array`, the keys will be typed as `Uint8Array`.
836
+ */
837
+ declare function getPublicAndPrivateKey(outputFormat: "uint8array"): PublicAndPrivateKey<Uint8Array>;
838
+ /**
839
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
840
+ *
841
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
842
+ *
843
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
844
+ *
845
+ * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
846
+ *
847
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
848
+ *
849
+ * Because you provided an `outputFormat` of either `text`, `hex` or `base64`, the keys will be typed as `string`.
850
+ */
851
+ declare function getPublicAndPrivateKey(outputFormat: "text" | "hex" | "base64"): PublicAndPrivateKey<string>;
852
+ //#endregion
774
853
  //#region src/functions/stringHelpers/appendSemicolon.d.ts
775
854
  /**
776
855
  * Appends a semicolon to the end of a string, trimming where necessary first.
@@ -1083,4 +1162,4 @@ interface ParseVersionOptions {
1083
1162
  */
1084
1163
  declare function parseVersion(input: string, options?: ParseVersionOptions): string;
1085
1164
  //#endregion
1086
- export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, stringListToArray, stringifyDotenv, truncate, wait };
1165
+ export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, ParseVersionOptions, PublicAndPrivateKey, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, stringListToArray, stringifyDotenv, truncate, wait };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import { ZodError, ZodType, z as z$1 } from "zod";
2
+ import sodium from "libsodium-wrappers";
2
3
  import { DotenvParseOutput } from "dotenv";
3
4
 
5
+ //#region src/constants/FILE_PATH_REGEX.d.ts
6
+ declare const FILE_PATH_REGEX: string;
7
+ //#endregion
4
8
  //#region src/constants/NAMESPACE_EXPORT_REGEX.d.ts
5
9
  declare const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
6
10
  //#endregion
@@ -341,6 +345,9 @@ declare class VersionNumber {
341
345
  */
342
346
  type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
343
347
  //#endregion
348
+ //#region src/types/CallReturnType.d.ts
349
+ type CallReturnType<Function, Arguments> = Function extends ((arg: Arguments) => infer Return) ? Return : never;
350
+ //#endregion
344
351
  //#region src/types/RecordKey.d.ts
345
352
  /**
346
353
  * Represents the native Record's possible key type.
@@ -410,9 +417,9 @@ type FormDataArrayResolutionStrategy = "stringify" | "multiple";
410
417
  *
411
418
  * @template Key - The type of the key of the input record.
412
419
  */
413
- interface CreateFormDataOptionsBase<Key$1 extends RecordKey> {
420
+ interface CreateFormDataOptionsBase<Key extends RecordKey> {
414
421
  /** How to resolve any arrays provided in the data (can either stringify them or add them multiple times). */
415
- arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key$1, FormDataArrayResolutionStrategy>>;
422
+ arrayResolution?: FormDataArrayResolutionStrategy | Partial<Record<Key, FormDataArrayResolutionStrategy>>;
416
423
  }
417
424
  /**
418
425
  * Options for resolving form data when it may be undefined or null, but not both.
@@ -421,11 +428,11 @@ interface CreateFormDataOptionsBase<Key$1 extends RecordKey> {
421
428
  *
422
429
  * @template Key - The type of the key of the input record.
423
430
  */
424
- interface CreateFormDataOptionsUndefinedOrNullResolution<Key$1 extends RecordKey> extends CreateFormDataOptionsBase<Key$1> {
431
+ interface CreateFormDataOptionsUndefinedOrNullResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
425
432
  /** How to resolve undefined data (May either stringify to 'undefined', resolve to an empty string, or omit entirely). */
426
- undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key$1, FormDataNullableResolutionStrategy>>;
433
+ undefinedResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
427
434
  /** How to resolve null data (May either stringify to 'null', resolve to an empty string, or omit entirely). */
428
- nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key$1, FormDataNullableResolutionStrategy>>;
435
+ nullResolution?: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
429
436
  /** @note This must not be provided at the same time as undefinedResolution and/or nullResolution. */
430
437
  nullableResolution?: never;
431
438
  }
@@ -436,13 +443,13 @@ interface CreateFormDataOptionsUndefinedOrNullResolution<Key$1 extends RecordKey
436
443
  *
437
444
  * @template Key - The type of the key of the input record.
438
445
  */
439
- interface CreateFormDataOptionsNullableResolution<Key$1 extends RecordKey> extends CreateFormDataOptionsBase<Key$1> {
446
+ interface CreateFormDataOptionsNullableResolution<Key extends RecordKey> extends CreateFormDataOptionsBase<Key> {
440
447
  /** @note This must not be provided at the same time as nullableResolution. */
441
448
  undefinedResolution?: never;
442
449
  /** @note This must not be provided at the same time as nullableResolution. */
443
450
  nullResolution?: never;
444
451
  /** How to resolve nullable data (May either stringify to 'undefined | null', resolve to an empty string, or omit entirely). */
445
- nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key$1, FormDataNullableResolutionStrategy>>;
452
+ nullableResolution: FormDataNullableResolutionStrategy | Partial<Record<Key, FormDataNullableResolutionStrategy>>;
446
453
  }
447
454
  /**
448
455
  * Options for resolving form data.
@@ -451,7 +458,7 @@ interface CreateFormDataOptionsNullableResolution<Key$1 extends RecordKey> exten
451
458
  *
452
459
  * @template Key - The type of the key of the input record.
453
460
  */
454
- type CreateFormDataOptions<Key$1 extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key$1> | CreateFormDataOptionsNullableResolution<Key$1>;
461
+ type CreateFormDataOptions<Key extends RecordKey> = CreateFormDataOptionsUndefinedOrNullResolution<Key> | CreateFormDataOptionsNullableResolution<Key>;
455
462
  /**
456
463
  * Creates FormData from a given object, resolving non-string types as appropriate.
457
464
  *
@@ -628,6 +635,28 @@ type Env = CreateEnumType<typeof Env>;
628
635
  */
629
636
  declare function parseEnv(data: unknown): Env;
630
637
  //#endregion
638
+ //#region src/functions/parsers/parseFilePath.d.ts
639
+ interface FilePathData {
640
+ /** The file path without the final part. */
641
+ directory: string;
642
+ /** The final part of the file path. */
643
+ base: string;
644
+ /** The full file path, normalised. */
645
+ fullPath: string;
646
+ }
647
+ /**
648
+ * Takes a file path string and parses it into the directory part, the base part, and the full path.
649
+ *
650
+ * @category Parsers
651
+ *
652
+ * @param filePath - The file path to parse.
653
+ *
654
+ * @throws {DataError} If the file path is invalid.
655
+ *
656
+ * @returns An object representing the different ways the file path can be represented.
657
+ */
658
+ declare function parseFilePath(filePath: string): FilePathData;
659
+ //#endregion
631
660
  //#region src/functions/parsers/parseFormData.d.ts
632
661
  /**
633
662
  * Returns a parsed object given FormData and a data parser function to call on the resulting object.
@@ -771,6 +800,56 @@ declare function deepFreeze<ObjectType extends object>(object: ObjectType): Read
771
800
  */
772
801
  declare function encryptWithKey(publicKey: string, plaintextValue: string): Promise<string>;
773
802
  //#endregion
803
+ //#region src/functions/security/getPublicAndPrivateKey.d.ts
804
+ interface PublicAndPrivateKey<KeyType extends Uint8Array | string> {
805
+ /** The generated public key from libsodium */
806
+ publicKey: KeyType;
807
+ /** The generated private key from libsodium */
808
+ privateKey: KeyType;
809
+ /** The key type from libsodium */
810
+ keyType: ReturnType<typeof sodium.crypto_box_keypair>["keyType"];
811
+ }
812
+ /**
813
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
814
+ *
815
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
816
+ *
817
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
818
+ *
819
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
820
+ *
821
+ * Because you have not provided an `outputFormat`, the keys will be typed as `Uint8Array`.
822
+ */
823
+ declare function getPublicAndPrivateKey(): PublicAndPrivateKey<Uint8Array>;
824
+ /**
825
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
826
+ *
827
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
828
+ *
829
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
830
+ *
831
+ * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
832
+ *
833
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
834
+ *
835
+ * Because you provided an `outputFormat` of `uint8array`, the keys will be typed as `Uint8Array`.
836
+ */
837
+ declare function getPublicAndPrivateKey(outputFormat: "uint8array"): PublicAndPrivateKey<Uint8Array>;
838
+ /**
839
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
840
+ *
841
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
842
+ *
843
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
844
+ *
845
+ * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
846
+ *
847
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
848
+ *
849
+ * Because you provided an `outputFormat` of either `text`, `hex` or `base64`, the keys will be typed as `string`.
850
+ */
851
+ declare function getPublicAndPrivateKey(outputFormat: "text" | "hex" | "base64"): PublicAndPrivateKey<string>;
852
+ //#endregion
774
853
  //#region src/functions/stringHelpers/appendSemicolon.d.ts
775
854
  /**
776
855
  * Appends a semicolon to the end of a string, trimming where necessary first.
@@ -1083,4 +1162,4 @@ interface ParseVersionOptions {
1083
1162
  */
1084
1163
  declare function parseVersion(input: string, options?: ParseVersionOptions): string;
1085
1164
  //#endregion
1086
- export { APIError, ArrayElement, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, type IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, type ParseVersionOptions, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, stringListToArray, stringifyDotenv, truncate, wait };
1165
+ export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, type IncrementVersionOptions, KebabToCamelOptions, NAMESPACE_EXPORT_REGEX, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, OptionalOnCondition, ParallelTuple, type ParseVersionOptions, type PublicAndPrivateKey, RecordKey, RemoveUndefined, StringListToArrayOptions, VERSION_NUMBER_REGEX, VersionNumber, VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, determineVersionType, encryptWithKey, fillArray, formatDateAndTime, getIndividualVersionNumbers, getInterpolations, getPublicAndPrivateKey, getRandomNumber, getRecordKeys, httpErrorCodeLookup, incrementVersion, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, kebabToCamel, normaliseImportPath, normaliseIndents, normalizeImportPath, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFilePath, parseFormData, parseIntStrict, parseVersion, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, stringListToArray, stringifyDotenv, truncate, wait };
package/dist/index.js CHANGED
@@ -1,7 +1,12 @@
1
1
  import z, { z as z$1 } from "zod";
2
- import sodium from "libsodium-wrappers";
3
2
  import path from "node:path";
3
+ import sodium from "libsodium-wrappers";
4
4
 
5
+ //#region src/constants/FILE_PATH_REGEX.ts
6
+ const FILE_PATH_REGEX = String.raw`^(?<directory>.+)[\/\\](?<base>[^\/\\]+)$`;
7
+ var FILE_PATH_REGEX_default = FILE_PATH_REGEX;
8
+
9
+ //#endregion
5
10
  //#region src/constants/NAMESPACE_EXPORT_REGEX.ts
6
11
  const NAMESPACE_EXPORT_REGEX = "export\\s+\\*\\s+from";
7
12
  var NAMESPACE_EXPORT_REGEX_default = NAMESPACE_EXPORT_REGEX;
@@ -623,17 +628,17 @@ function createFormData(data, options = {
623
628
  default: throw new TypeError("SLOPPY_PURE_JAVASCRIPT_USER_ERROR");
624
629
  }
625
630
  }
626
- function resolveNullables(key, value, options$1) {
627
- if (options$1.nullableResolution) {
628
- resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.nullableResolution));
631
+ function resolveNullables(key, value, options) {
632
+ if (options.nullableResolution) {
633
+ resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options.nullableResolution));
629
634
  return;
630
635
  }
631
- if (options$1.undefinedResolution || options$1.nullResolution) {
632
- if (data[key] === void 0 && options$1.undefinedResolution) {
633
- resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.undefinedResolution));
636
+ if (options.undefinedResolution || options.nullResolution) {
637
+ if (data[key] === void 0 && options.undefinedResolution) {
638
+ resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options.undefinedResolution));
634
639
  return;
635
640
  }
636
- if (data[key] === null && options$1.nullResolution) resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options$1.nullResolution));
641
+ if (data[key] === null && options.nullResolution) resolveNullablesByStrategy(key, value, getNullableResolutionStrategy(key, options.nullResolution));
637
642
  }
638
643
  }
639
644
  const entries = Object.entries(data);
@@ -854,8 +859,8 @@ function _parseZodSchema(parsedResult, data, onError) {
854
859
  }
855
860
  throw new DataError_default(data, Object.entries(allErrorCodes).toSorted(([_, firstCount], [__, secondCount]) => {
856
861
  return secondCount - firstCount;
857
- }).map(([code, count], _, allErrorCodes$1) => {
858
- return allErrorCodes$1.length === 1 && count === 1 ? code : `${code}×${count}`;
862
+ }).map(([code, count], _, allErrorCodes) => {
863
+ return allErrorCodes.length === 1 && count === 1 ? code : `${code}×${count}`;
859
864
  }).join(","), `\n\n${z.prettifyError(parsedResult.error)}\n`);
860
865
  }
861
866
  return parsedResult.data;
@@ -915,6 +920,38 @@ function parseEnv(data) {
915
920
  }
916
921
  var parseEnv_default = parseEnv;
917
922
 
923
+ //#endregion
924
+ //#region src/functions/parsers/parseFilePath.ts
925
+ /**
926
+ * Takes a file path string and parses it into the directory part, the base part, and the full path.
927
+ *
928
+ * @category Parsers
929
+ *
930
+ * @param filePath - The file path to parse.
931
+ *
932
+ * @throws {DataError} If the file path is invalid.
933
+ *
934
+ * @returns An object representing the different ways the file path can be represented.
935
+ */
936
+ function parseFilePath(filePath) {
937
+ const caughtGroups = filePath.match(RegExp(FILE_PATH_REGEX_default));
938
+ if (!caughtGroups) {
939
+ if (!(filePath.includes("/") || filePath.includes("\\")) && filePath.includes(".")) return {
940
+ directory: "",
941
+ base: filePath,
942
+ fullPath: filePath
943
+ };
944
+ throw new DataError_default({ filePath }, "INVALID_FILE_PATH", "The file path you provided is not valid.");
945
+ }
946
+ if (!caughtGroups.groups) throw new DataError_default({ filePath }, "PARSING_ERROR", "An error occurred while trying to parse the data.");
947
+ return {
948
+ directory: caughtGroups.groups.directory,
949
+ base: caughtGroups.groups.base,
950
+ fullPath: path.join(caughtGroups.groups.directory.replaceAll("\\", "/"), caughtGroups.groups.base)
951
+ };
952
+ }
953
+ var parseFilePath_default = parseFilePath;
954
+
918
955
  //#endregion
919
956
  //#region src/functions/parsers/parseFormData.ts
920
957
  /**
@@ -1066,6 +1103,32 @@ async function encryptWithKey(publicKey, plaintextValue) {
1066
1103
  }
1067
1104
  var encryptWithKey_default = encryptWithKey;
1068
1105
 
1106
+ //#endregion
1107
+ //#region src/functions/security/getPublicAndPrivateKey.ts
1108
+ /**
1109
+ * Returns the public key and private key, properly narrowing down types depending on the provided `outputFormat`.
1110
+ *
1111
+ * @deprecated Please use `sodium.crypto_box_keypair` from `libsodium-wrappers` instead.
1112
+ *
1113
+ * This function was initially created to deal with a typing issue with the package introduced in v0.8.1 of said package, but this seems to have been fixed in v0.8.2
1114
+ *
1115
+ * @param outputFormat - The format of the resulting publicKey and privateKey you would like to use.
1116
+ *
1117
+ * @returns An object containing both the publicKey and privateKey, along with a keyType.
1118
+ */
1119
+ function getPublicAndPrivateKey(outputFormat) {
1120
+ const keys = sodium.crypto_box_keypair(outputFormat);
1121
+ if (outputFormat === "uint8array" || outputFormat === void 0) {
1122
+ if (!(keys?.publicKey instanceof Uint8Array && keys?.privateKey instanceof Uint8Array)) throw new DataError_default({
1123
+ publicKey: `<redacted: ${keys?.publicKey?.constructor?.name ?? typeof keys?.publicKey}>`,
1124
+ privateKey: `<redacted: ${keys?.privateKey?.constructor?.name ?? typeof keys?.privateKey}>`
1125
+ }, "INVALID_KEY_TYPES", "Expected Uint8Array keypair from libsodium.");
1126
+ return keys;
1127
+ }
1128
+ return keys;
1129
+ }
1130
+ var getPublicAndPrivateKey_default = getPublicAndPrivateKey;
1131
+
1069
1132
  //#endregion
1070
1133
  //#region src/functions/stringHelpers/appendSemicolon.ts
1071
1134
  /**
@@ -1113,8 +1176,8 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
1113
1176
  result += sequenceOfCapitals.toLowerCase();
1114
1177
  } else {
1115
1178
  if (result) result += "-";
1116
- result += sequenceOfCapitals.split("").map((character$1) => {
1117
- return character$1.toLowerCase();
1179
+ result += sequenceOfCapitals.split("").map((character) => {
1180
+ return character.toLowerCase();
1118
1181
  }).join("-");
1119
1182
  }
1120
1183
  outerIndex = innerIndex;
@@ -1369,9 +1432,9 @@ function reduceLines(lines, { preserveTabs = true }) {
1369
1432
  */
1370
1433
  function normaliseIndents(first, ...args) {
1371
1434
  if (typeof first === "object" && first !== null && !Array.isArray(first)) {
1372
- const options$1 = first;
1373
- return (strings$1, ...interpolations) => {
1374
- return normaliseIndents(strings$1, ...interpolations, options$1);
1435
+ const options = first;
1436
+ return (strings, ...interpolations) => {
1437
+ return normaliseIndents(strings, ...interpolations, options);
1375
1438
  };
1376
1439
  }
1377
1440
  const strings = first;
@@ -1498,4 +1561,4 @@ function incrementVersion(version, incrementType, options) {
1498
1561
  var incrementVersion_default = incrementVersion;
1499
1562
 
1500
1563
  //#endregion
1501
- export { APIError_default as APIError, DataError_default as DataError, Env, NAMESPACE_EXPORT_REGEX_default as NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX_default as VERSION_NUMBER_REGEX, VersionNumber_default as VersionNumber, VersionType, addDaysToDate_default as addDaysToDate, appendSemicolon_default as appendSemicolon, camelToKebab_default as camelToKebab, convertFileToBase64_default as convertFileToBase64, createFormData_default as createFormData, createTemplateStringsArray_default as createTemplateStringsArray, deepCopy_default as deepCopy, deepFreeze_default as deepFreeze, determineVersionType_default as determineVersionType, encryptWithKey_default as encryptWithKey, fillArray_default as fillArray, formatDateAndTime_default as formatDateAndTime, getIndividualVersionNumbers_default as getIndividualVersionNumbers, getInterpolations_default as getInterpolations, getRandomNumber_default as getRandomNumber, getRecordKeys_default as getRecordKeys, httpErrorCodeLookup, incrementVersion_default as incrementVersion, interpolate_default as interpolate, interpolateObjects_default as interpolateObjects, isAnniversary_default as isAnniversary, isLeapYear_default as isLeapYear, isMonthlyMultiple_default as isMonthlyMultiple, isOrdered_default as isOrdered, isSameDate_default as isSameDate, kebabToCamel_default as kebabToCamel, normaliseImportPath, normaliseIndents_default as normaliseIndents, normalizeImportPath_default as normalizeImportPath, normalizeIndents, omitProperties_default as omitProperties, paralleliseArrays_default as paralleliseArrays, parseBoolean_default as parseBoolean, parseEnv_default as parseEnv, parseFormData_default as parseFormData, parseIntStrict_default as parseIntStrict, parseVersion_default as parseVersion, parseVersionType_default as parseVersionType, parseZodSchema_default as parseZodSchema, parseZodSchemaAsync_default as parseZodSchemaAsync, randomiseArray_default as randomiseArray, range_default as range, removeDuplicates_default as removeDuplicates, removeUndefinedFromObject_default as removeUndefinedFromObject, stringListToArray_default as stringListToArray, stringifyDotenv_default as stringifyDotenv, truncate_default as truncate, wait_default as wait };
1564
+ export { APIError_default as APIError, DataError_default as DataError, Env, FILE_PATH_REGEX_default as FILE_PATH_REGEX, NAMESPACE_EXPORT_REGEX_default as NAMESPACE_EXPORT_REGEX, VERSION_NUMBER_REGEX_default as VERSION_NUMBER_REGEX, VersionNumber_default as VersionNumber, VersionType, addDaysToDate_default as addDaysToDate, appendSemicolon_default as appendSemicolon, camelToKebab_default as camelToKebab, convertFileToBase64_default as convertFileToBase64, createFormData_default as createFormData, createTemplateStringsArray_default as createTemplateStringsArray, deepCopy_default as deepCopy, deepFreeze_default as deepFreeze, determineVersionType_default as determineVersionType, encryptWithKey_default as encryptWithKey, fillArray_default as fillArray, formatDateAndTime_default as formatDateAndTime, getIndividualVersionNumbers_default as getIndividualVersionNumbers, getInterpolations_default as getInterpolations, getPublicAndPrivateKey_default as getPublicAndPrivateKey, getRandomNumber_default as getRandomNumber, getRecordKeys_default as getRecordKeys, httpErrorCodeLookup, incrementVersion_default as incrementVersion, interpolate_default as interpolate, interpolateObjects_default as interpolateObjects, isAnniversary_default as isAnniversary, isLeapYear_default as isLeapYear, isMonthlyMultiple_default as isMonthlyMultiple, isOrdered_default as isOrdered, isSameDate_default as isSameDate, kebabToCamel_default as kebabToCamel, normaliseImportPath, normaliseIndents_default as normaliseIndents, normalizeImportPath_default as normalizeImportPath, normalizeIndents, omitProperties_default as omitProperties, paralleliseArrays_default as paralleliseArrays, parseBoolean_default as parseBoolean, parseEnv_default as parseEnv, parseFilePath_default as parseFilePath, parseFormData_default as parseFormData, parseIntStrict_default as parseIntStrict, parseVersion_default as parseVersion, parseVersionType_default as parseVersionType, parseZodSchema_default as parseZodSchema, parseZodSchemaAsync_default as parseZodSchemaAsync, randomiseArray_default as randomiseArray, range_default as range, removeDuplicates_default as removeDuplicates, removeUndefinedFromObject_default as removeUndefinedFromObject, stringListToArray_default as stringListToArray, stringifyDotenv_default as stringifyDotenv, truncate_default as truncate, wait_default as wait };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "4.10.2",
3
+ "version": "4.12.0",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,26 +17,25 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "dotenv": "^17.2.3",
20
- "libsodium-wrappers": "^0.8.0",
21
- "zod": "^4.3.5"
20
+ "libsodium-wrappers": "^0.8.2",
21
+ "zod": "^4.3.6"
22
22
  },
23
23
  "devDependencies": {
24
- "@alextheman/eslint-plugin": "^5.4.2",
25
- "@types/libsodium-wrappers": "^0.7.14",
26
- "@types/node": "^25.0.9",
27
- "@typescript-eslint/types": "^8.53.0",
28
- "alex-c-line": "^1.20.0",
24
+ "@alextheman/eslint-plugin": "^5.5.0",
25
+ "@types/node": "^25.1.0",
26
+ "@typescript-eslint/types": "^8.54.0",
27
+ "alex-c-line": "^1.21.2",
29
28
  "dotenv-cli": "^11.0.0",
30
29
  "eslint": "^9.39.2",
31
- "globals": "^17.0.0",
30
+ "globals": "^17.2.0",
32
31
  "husky": "^9.1.7",
33
32
  "jsdom": "^27.4.0",
34
- "prettier": "^3.8.0",
35
- "tsdown": "^0.19.0",
33
+ "prettier": "^3.8.1",
34
+ "tsdown": "^0.20.1",
36
35
  "typedoc": "^0.28.16",
37
36
  "typescript": "^5.9.3",
38
- "vite-tsconfig-paths": "^6.0.4",
39
- "vitest": "^4.0.17"
37
+ "vite-tsconfig-paths": "^6.0.5",
38
+ "vitest": "^4.0.18"
40
39
  },
41
40
  "engines": {
42
41
  "node": ">=22.0.0"