@alextheman/utility 5.7.1 → 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/dist/index.cjs +13 -0
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +13 -1
- package/package.json +1 -1
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
|
@@ -912,6 +912,16 @@ interface CamelToKebabOptions {
|
|
|
912
912
|
*/
|
|
913
913
|
declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
|
|
914
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
|
|
915
925
|
//#region src/root/functions/stringHelpers/kebabToCamel.d.ts
|
|
916
926
|
/**
|
|
917
927
|
* Options to apply to the conversion from kebab-case to camelCase
|
|
@@ -1125,4 +1135,4 @@ declare const normalizeIndents: typeof normaliseIndents;
|
|
|
1125
1135
|
*/
|
|
1126
1136
|
type RecordKey = string | number | symbol;
|
|
1127
1137
|
//#endregion
|
|
1128
|
-
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, 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 };
|
|
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
|
@@ -912,6 +912,16 @@ interface CamelToKebabOptions {
|
|
|
912
912
|
*/
|
|
913
913
|
declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
|
|
914
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
|
|
915
925
|
//#region src/root/functions/stringHelpers/kebabToCamel.d.ts
|
|
916
926
|
/**
|
|
917
927
|
* Options to apply to the conversion from kebab-case to camelCase
|
|
@@ -1125,4 +1135,4 @@ declare const normalizeIndents: typeof normaliseIndents;
|
|
|
1125
1135
|
*/
|
|
1126
1136
|
type RecordKey = string | number | symbol;
|
|
1127
1137
|
//#endregion
|
|
1128
|
-
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, 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 };
|
|
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 };
|