@alextheman/utility 5.21.0 → 5.22.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 +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1611,6 +1611,18 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
|
|
|
1611
1611
|
return result;
|
|
1612
1612
|
}
|
|
1613
1613
|
//#endregion
|
|
1614
|
+
//#region src/root/functions/stringHelpers/escapeHTML.ts
|
|
1615
|
+
/**
|
|
1616
|
+
* Escapes a raw HTML string so it can be safely used in HTML templates.
|
|
1617
|
+
*
|
|
1618
|
+
* @param rawString - The raw string to escape
|
|
1619
|
+
*
|
|
1620
|
+
* @returns A new string, with the contents of the original string but with HTML characters safely encoded.
|
|
1621
|
+
*/
|
|
1622
|
+
function escapeHTML(rawString) {
|
|
1623
|
+
return rawString.replaceAll(/&/g, "&").replaceAll(/</g, "<").replaceAll(/>/g, ">").replaceAll(/"/g, """).replaceAll(/'/g, "'");
|
|
1624
|
+
}
|
|
1625
|
+
//#endregion
|
|
1614
1626
|
//#region src/root/functions/stringHelpers/escapeRegexPattern.ts
|
|
1615
1627
|
/**
|
|
1616
1628
|
* A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
|
|
@@ -2034,6 +2046,7 @@ exports.createFormData = createFormData;
|
|
|
2034
2046
|
exports.createTemplateStringsArray = createTemplateStringsArray;
|
|
2035
2047
|
exports.deepCopy = deepCopy;
|
|
2036
2048
|
exports.deepFreeze = deepFreeze;
|
|
2049
|
+
exports.escapeHTML = escapeHTML;
|
|
2037
2050
|
exports.escapeRegexPattern = escapeRegexPattern;
|
|
2038
2051
|
exports.fillArray = fillArray;
|
|
2039
2052
|
exports.formatDateAndTime = formatDateAndTime;
|
package/dist/index.d.cts
CHANGED
|
@@ -924,6 +924,16 @@ interface CamelToKebabOptions {
|
|
|
924
924
|
*/
|
|
925
925
|
declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
|
|
926
926
|
//#endregion
|
|
927
|
+
//#region src/root/functions/stringHelpers/escapeHTML.d.ts
|
|
928
|
+
/**
|
|
929
|
+
* Escapes a raw HTML string so it can be safely used in HTML templates.
|
|
930
|
+
*
|
|
931
|
+
* @param rawString - The raw string to escape
|
|
932
|
+
*
|
|
933
|
+
* @returns A new string, with the contents of the original string but with HTML characters safely encoded.
|
|
934
|
+
*/
|
|
935
|
+
declare function escapeHTML(rawString: string): string;
|
|
936
|
+
//#endregion
|
|
927
937
|
//#region src/root/functions/stringHelpers/escapeRegexPattern.d.ts
|
|
928
938
|
/**
|
|
929
939
|
* A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
|
|
@@ -1457,4 +1467,4 @@ interface ZodParsingErrorData {
|
|
|
1457
1467
|
issues: Array<z.core.$ZodIssue>;
|
|
1458
1468
|
}
|
|
1459
1469
|
//#endregion
|
|
1460
|
-
export { APIError, type ArrayElement, type CallReturnType, type 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, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1470
|
+
export { APIError, type ArrayElement, type CallReturnType, type 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, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/index.d.ts
CHANGED
|
@@ -924,6 +924,16 @@ interface CamelToKebabOptions {
|
|
|
924
924
|
*/
|
|
925
925
|
declare function camelToKebab(string: string, options?: CamelToKebabOptions): string;
|
|
926
926
|
//#endregion
|
|
927
|
+
//#region src/root/functions/stringHelpers/escapeHTML.d.ts
|
|
928
|
+
/**
|
|
929
|
+
* Escapes a raw HTML string so it can be safely used in HTML templates.
|
|
930
|
+
*
|
|
931
|
+
* @param rawString - The raw string to escape
|
|
932
|
+
*
|
|
933
|
+
* @returns A new string, with the contents of the original string but with HTML characters safely encoded.
|
|
934
|
+
*/
|
|
935
|
+
declare function escapeHTML(rawString: string): string;
|
|
936
|
+
//#endregion
|
|
927
937
|
//#region src/root/functions/stringHelpers/escapeRegexPattern.d.ts
|
|
928
938
|
/**
|
|
929
939
|
* A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
|
|
@@ -1457,4 +1467,4 @@ interface ZodParsingErrorData {
|
|
|
1457
1467
|
issues: Array<z$1.core.$ZodIssue>;
|
|
1458
1468
|
}
|
|
1459
1469
|
//#endregion
|
|
1460
|
-
export { APIError, type ArrayElement, type CallReturnType, type 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, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1470
|
+
export { APIError, type ArrayElement, type CallReturnType, type 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, type KebabToCamelOptions, type NonNull, type NonUndefined, type NormaliseIndentsFunction, type NormaliseIndentsOptions, type NormalizeIndentsFunction, type NormalizeIndentsOptions, type NullableOnCondition, ONE_DAY_IN_MILLISECONDS, type OptionalOnCondition, type ParallelTuple, type RecordKey, type RemoveUndefined, SortDirection, type StringListToArrayOptions, type ToTitleCaseOptions, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, type FormatOptionsBase as VersionNumberToStringOptions, VersionType, type ZodParsingErrorData, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/dist/index.js
CHANGED
|
@@ -1587,6 +1587,18 @@ function camelToKebab(string, options = { preserveConsecutiveCapitals: true }) {
|
|
|
1587
1587
|
return result;
|
|
1588
1588
|
}
|
|
1589
1589
|
//#endregion
|
|
1590
|
+
//#region src/root/functions/stringHelpers/escapeHTML.ts
|
|
1591
|
+
/**
|
|
1592
|
+
* Escapes a raw HTML string so it can be safely used in HTML templates.
|
|
1593
|
+
*
|
|
1594
|
+
* @param rawString - The raw string to escape
|
|
1595
|
+
*
|
|
1596
|
+
* @returns A new string, with the contents of the original string but with HTML characters safely encoded.
|
|
1597
|
+
*/
|
|
1598
|
+
function escapeHTML(rawString) {
|
|
1599
|
+
return rawString.replaceAll(/&/g, "&").replaceAll(/</g, "<").replaceAll(/>/g, ">").replaceAll(/"/g, """).replaceAll(/'/g, "'");
|
|
1600
|
+
}
|
|
1601
|
+
//#endregion
|
|
1590
1602
|
//#region src/root/functions/stringHelpers/escapeRegexPattern.ts
|
|
1591
1603
|
/**
|
|
1592
1604
|
* A function to properly handle escape sequences in a Regex pattern string, so it can be safely used with the `RegExp` constructor.
|
|
@@ -1983,4 +1995,4 @@ var DataError = class DataError extends Error {
|
|
|
1983
1995
|
}
|
|
1984
1996
|
};
|
|
1985
1997
|
//#endregion
|
|
1986
|
-
export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, SortDirection, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
|
1998
|
+
export { APIError, DataError, Env, FILE_PATH_PATTERN, FILE_PATH_REGEX, ONE_DAY_IN_MILLISECONDS, SortDirection, UUID_PATTERN, UUID_REGEX, VERSION_NUMBER_PATTERN, VERSION_NUMBER_REGEX, VersionNumber, VersionType, addDaysToDate, appendSemicolon, assertNotNull, assertNotNullable, assertNotUndefined, az, calculateMonthlyDifference, camelToKebab, containsKeys, convertFileToBase64, createFormData, createTemplateStringsArray, deepCopy, deepFreeze, escapeHTML, escapeRegexPattern, fillArray, formatDateAndTime, getRandomNumber, getRecordKeys, getStringsAndInterpolations, httpErrorCodeLookup, identity, interpolate, interpolateObjects, isAnniversary, isLeapYear, isMonthlyMultiple, isNonNullableObject, isOrdered, isSameDate, isTemplateStringsArray, kebabToCamel, normaliseIndents, normalizeIndents, objectContainsKeys, omitProperties, paralleliseArrays, parseBoolean, parseEnv, parseFormData, parseIntStrict, parseUUID, parseVersionType, parseZodSchema, parseZodSchemaAsync, randomiseArray, range, removeDuplicates, removeUndefinedFromObject, sayHello, sortBy, stringListToArray, stringifyDotenv, toTitleCase, truncate, wait, zodVersionNumber };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.22.0",
|
|
4
4
|
"description": "Helpful utility functions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@alextheman/eslint-plugin": "5.17.0",
|
|
44
44
|
"@types/node": "25.9.3",
|
|
45
|
-
"alex-c-line": "2.9.
|
|
45
|
+
"alex-c-line": "2.9.3",
|
|
46
46
|
"cross-env": "10.1.0",
|
|
47
47
|
"dotenv-cli": "11.0.0",
|
|
48
|
-
"eslint": "10.
|
|
48
|
+
"eslint": "10.5.0",
|
|
49
49
|
"globals": "17.6.0",
|
|
50
50
|
"husky": "9.1.7",
|
|
51
51
|
"jsdom": "29.1.1",
|