@alextheman/utility 5.7.0 → 5.8.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- MIT License Copyright (c) 2025 AlexMan123456
1
+ MIT License Copyright (c) 2026 alextheman231
2
2
 
3
3
  Permission is hereby granted, free
4
4
  of charge, to any person obtaining a copy of this software and associated
@@ -18,4 +18,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
18
  EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
19
  OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
20
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -35,6 +35,6 @@ const myVariable: NonUndefined<string> = formatDateAndTime(new Date());
35
35
 
36
36
  ## Documentation
37
37
 
38
- You can find the relevant documentation of all features of the package in the [docs/features/markdown](https://github.com/alextheman231/utility/tree/main/docs/features/markdown) directory of the repository. The hosted documentation site can be found [here](https://alextheman231.github.io/utility/).
38
+ You can find the relevant documentation of all features of the package in the hosted documentation site [here](https://alextheman231.github.io/utility/).
39
39
 
40
40
  See the GitHub repository [here](https://github.com/alextheman231/utility).
package/dist/index.cjs CHANGED
@@ -1541,6 +1541,18 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
1541
1541
  return result;
1542
1542
  }
1543
1543
  //#endregion
1544
+ //#region src/root/functions/stringHelpers/escapeRegexPattern.ts
1545
+ /**
1546
+ * A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
1547
+ *
1548
+ * @param regexPattern - The Regex pattern to escape.
1549
+ *
1550
+ * @returns A new string with escape sequences properly handled.
1551
+ */
1552
+ function escapeRegexPattern(regexPattern) {
1553
+ return regexPattern.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
1554
+ }
1555
+ //#endregion
1544
1556
  //#region src/root/functions/stringHelpers/kebabToCamel.ts
1545
1557
  /**
1546
1558
  * Converts a string from kebab-case to camelCase
@@ -1617,6 +1629,7 @@ exports.createTemplateStringsArray = createTemplateStringsArray;
1617
1629
  exports.deepCopy = deepCopy;
1618
1630
  exports.deepFreeze = deepFreeze;
1619
1631
  exports.encryptWithKey = encryptWithKey;
1632
+ exports.escapeRegexPattern = escapeRegexPattern;
1620
1633
  exports.fillArray = fillArray;
1621
1634
  exports.formatDateAndTime = formatDateAndTime;
1622
1635
  exports.getRandomNumber = getRandomNumber;
package/dist/index.d.cts CHANGED
@@ -616,16 +616,6 @@ declare class VersionNumber {
616
616
  }
617
617
  declare const zodVersionNumber: z$1.ZodType<VersionNumber>;
618
618
  //#endregion
619
- //#region src/root/deprecated/RecordKey.d.ts
620
- /**
621
- * Represents the native Record's possible key type.
622
- *
623
- * @category Types
624
- *
625
- * @deprecated Please use the native `PropertyKey` type instead.
626
- */
627
- type RecordKey = string | number | symbol;
628
- //#endregion
629
619
  //#region src/root/types/ArrayElement.d.ts
630
620
  /**
631
621
  * Gets the individual element types from an array type.
@@ -922,6 +912,16 @@ interface CamelToKebabOptions {
922
912
  */
923
913
  declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
924
914
  //#endregion
915
+ //#region src/root/functions/stringHelpers/escapeRegexPattern.d.ts
916
+ /**
917
+ * A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
918
+ *
919
+ * @param regexPattern - The Regex pattern to escape.
920
+ *
921
+ * @returns A new string with escape sequences properly handled.
922
+ */
923
+ declare function escapeRegexPattern(regexPattern: string): string;
924
+ //#endregion
925
925
  //#region src/root/functions/stringHelpers/kebabToCamel.d.ts
926
926
  /**
927
927
  * Options to apply to the conversion from kebab-case to camelCase
@@ -1125,4 +1125,14 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1125
1125
  */
1126
1126
  declare const normalizeIndents: typeof normaliseIndents;
1127
1127
  //#endregion
1128
- export { APIError, ArrayElement, CallReturnType, CamelToKebabOptions, CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, HTTPErrorCode, IgnoreCase, IsTypeArgumentString, KebabToCamelOptions, NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, NullableOnCondition, ONE_DAY_IN_MILLISECONDS, OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1128
+ //#region src/root/deprecated/RecordKey.d.ts
1129
+ /**
1130
+ * Represents the native Record's possible key type.
1131
+ *
1132
+ * @category Types
1133
+ *
1134
+ * @deprecated Please use the native `PropertyKey` type instead.
1135
+ */
1136
+ type RecordKey = string | number | symbol;
1137
+ //#endregion
1138
+ export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
package/dist/index.d.ts CHANGED
@@ -616,16 +616,6 @@ declare class VersionNumber {
616
616
  }
617
617
  declare const zodVersionNumber: z$1.ZodType<VersionNumber>;
618
618
  //#endregion
619
- //#region src/root/deprecated/RecordKey.d.ts
620
- /**
621
- * Represents the native Record's possible key type.
622
- *
623
- * @category Types
624
- *
625
- * @deprecated Please use the native `PropertyKey` type instead.
626
- */
627
- type RecordKey = string | number | symbol;
628
- //#endregion
629
619
  //#region src/root/types/ArrayElement.d.ts
630
620
  /**
631
621
  * Gets the individual element types from an array type.
@@ -922,6 +912,16 @@ interface CamelToKebabOptions {
922
912
  */
923
913
  declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
924
914
  //#endregion
915
+ //#region src/root/functions/stringHelpers/escapeRegexPattern.d.ts
916
+ /**
917
+ * A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
918
+ *
919
+ * @param regexPattern - The Regex pattern to escape.
920
+ *
921
+ * @returns A new string with escape sequences properly handled.
922
+ */
923
+ declare function escapeRegexPattern(regexPattern: string): string;
924
+ //#endregion
925
925
  //#region src/root/functions/stringHelpers/kebabToCamel.d.ts
926
926
  /**
927
927
  * Options to apply to the conversion from kebab-case to camelCase
@@ -1125,4 +1125,14 @@ declare function normaliseIndents(strings: TemplateStringsArray, ...interpolatio
1125
1125
  */
1126
1126
  declare const normalizeIndents: typeof normaliseIndents;
1127
1127
  //#endregion
1128
- export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, CreateFormDataOptions, CreateFormDataOptionsNullableResolution, CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, FormDataArrayResolutionStrategy, FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, type RecordKey, RemoveUndefined, StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1128
+ //#region src/root/deprecated/RecordKey.d.ts
1129
+ /**
1130
+ * Represents the native Record's possible key type.
1131
+ *
1132
+ * @category Types
1133
+ *
1134
+ * @deprecated Please use the native `PropertyKey` type instead.
1135
+ */
1136
+ type RecordKey = string | number | symbol;
1137
+ //#endregion
1138
+ export { APIError, type ArrayElement, type CallReturnType, CamelToKebabOptions, type CreateEnumType, type CreateFormDataOptions, type CreateFormDataOptionsNullableResolution, type CreateFormDataOptionsUndefinedOrNullResolution, DataError, type DisallowUndefined, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, type FormDataArrayResolutionStrategy, type FormDataNullableResolutionStrategy, type HTTPErrorCode, type IgnoreCase, type IsTypeArgumentString, KebabToCamelOptions, type NonUndefined, NormaliseIndentsFunction, NormaliseIndentsOptions, NormalizeIndentsFunction, NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, ParallelTuple, RecordKey, RemoveUndefined, type StringListToArrayOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
package/dist/index.js CHANGED
@@ -1516,6 +1516,18 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
1516
1516
  return result;
1517
1517
  }
1518
1518
  //#endregion
1519
+ //#region src/root/functions/stringHelpers/escapeRegexPattern.ts
1520
+ /**
1521
+ * A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
1522
+ *
1523
+ * @param regexPattern - The Regex pattern to escape.
1524
+ *
1525
+ * @returns A new string with escape sequences properly handled.
1526
+ */
1527
+ function escapeRegexPattern(regexPattern) {
1528
+ return regexPattern.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
1529
+ }
1530
+ //#endregion
1519
1531
  //#region src/root/functions/stringHelpers/kebabToCamel.ts
1520
1532
  /**
1521
1533
  * Converts a string from kebab-case to camelCase
@@ -1570,4 +1582,4 @@ function truncate(stringToTruncate, maxLength = 5) {
1570
1582
  return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
1571
1583
  }
1572
1584
  //#endregion
1573
- export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
1585
+ export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, calculateMonthlyDifference, camelToKebab, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, encryptWithKey, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, stringListToArray, stringifyDotenv, truncate, wait, zodVersionNumber };
@@ -1,6 +1,5 @@
1
1
  import z from "zod";
2
2
  import { ExecaMethod } from "execa";
3
-
4
3
  //#region src/root/functions/miscellaneous/sayHello.d.ts
5
4
  /**
6
5
  * Returns a string representing the lyrics to the package's theme song, Commit To You
@@ -65,4 +65,4 @@ declare function sayHello(): string;
65
65
  //#region src/root/types/IsTypeArgumentString.d.ts
66
66
  type IsTypeArgumentString<Argument extends string> = Argument;
67
67
  //#endregion
68
- export { IsTypeArgumentString, normaliseImportPath, normalizeImportPath, parseFilePath, sayHello };
68
+ export { type IsTypeArgumentString, normaliseImportPath, normalizeImportPath, parseFilePath, sayHello };
@@ -1,5 +1,4 @@
1
1
  import z from "zod";
2
-
3
2
  //#region src/node/functions/normalizeImportPath.d.ts
4
3
  /**
5
4
  * Normalizes an import path meant for use in an import statement in JavaScript.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "Helpful utility functions.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "devDependencies": {
39
39
  "@alextheman/eslint-plugin": "^5.10.2",
40
40
  "@types/node": "^25.5.0",
41
- "alex-c-line": "^2.2.5",
41
+ "alex-c-line": "^2.4.0",
42
42
  "cross-env": "^10.1.0",
43
43
  "dotenv-cli": "^11.0.0",
44
44
  "eslint": "^10.1.0",
@@ -47,12 +47,13 @@
47
47
  "jsdom": "^29.0.1",
48
48
  "prettier": "^3.8.1",
49
49
  "tempy": "^3.2.0",
50
- "tsdown": "^0.21.4",
50
+ "tsdown": "^0.21.6",
51
51
  "tsx": "^4.21.0",
52
- "typedoc": "^0.28.17",
52
+ "typedoc": "^0.28.18",
53
53
  "typescript": "^5.9.3",
54
+ "typescript-eslint": "^8.57.2",
54
55
  "vite-tsconfig-paths": "^6.1.1",
55
- "vitest": "^4.1.0"
56
+ "vitest": "^4.1.2"
56
57
  },
57
58
  "engines": {
58
59
  "node": ">=22.3.0"