@trackunit/shared-utils 0.0.63 → 0.0.64
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/index.cjs.js +15 -0
- package/index.esm.js +15 -1
- package/package.json +1 -1
- package/src/stringUtils.d.ts +7 -0
package/index.cjs.js
CHANGED
|
@@ -1046,6 +1046,20 @@ const titleCase = (s) => {
|
|
|
1046
1046
|
* @example removeLeftPadding("00000000-0000-0000-0000-000000000010") // 10
|
|
1047
1047
|
*/
|
|
1048
1048
|
const removeLeftPadding = (id) => Number(id === null || id === void 0 ? void 0 : id.replace(/-/g, "").replace(/^0+/, ""));
|
|
1049
|
+
/**
|
|
1050
|
+
* Removes hidden characters from a string.
|
|
1051
|
+
*
|
|
1052
|
+
* @param input - The input string to clean.
|
|
1053
|
+
* @returns {string} The cleaned string with hidden characters removed.
|
|
1054
|
+
*/
|
|
1055
|
+
const stripHiddenCharacters = (input) => {
|
|
1056
|
+
// Regular expression to match various hidden characters
|
|
1057
|
+
const hiddenRegex = new RegExp(
|
|
1058
|
+
// eslint-disable-next-line no-control-regex
|
|
1059
|
+
/[\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB\u0000-\u001F\u007F-\u009F]/gu);
|
|
1060
|
+
// Replace hidden characters with an empty string
|
|
1061
|
+
return input.replace(hiddenRegex, "");
|
|
1062
|
+
};
|
|
1049
1063
|
|
|
1050
1064
|
/* eslint-disable local-rules/prefer-custom-object-keys */
|
|
1051
1065
|
/* eslint-disable local-rules/prefer-custom-object-from-entries */
|
|
@@ -1122,6 +1136,7 @@ exports.size = size;
|
|
|
1122
1136
|
exports.stringCompare = stringCompare;
|
|
1123
1137
|
exports.stringCompareFromKey = stringCompareFromKey;
|
|
1124
1138
|
exports.stringNaturalCompare = stringNaturalCompare;
|
|
1139
|
+
exports.stripHiddenCharacters = stripHiddenCharacters;
|
|
1125
1140
|
exports.titleCase = titleCase;
|
|
1126
1141
|
exports.toID = toID;
|
|
1127
1142
|
exports.toIDs = toIDs;
|
package/index.esm.js
CHANGED
|
@@ -1042,6 +1042,20 @@ const titleCase = (s) => {
|
|
|
1042
1042
|
* @example removeLeftPadding("00000000-0000-0000-0000-000000000010") // 10
|
|
1043
1043
|
*/
|
|
1044
1044
|
const removeLeftPadding = (id) => Number(id === null || id === void 0 ? void 0 : id.replace(/-/g, "").replace(/^0+/, ""));
|
|
1045
|
+
/**
|
|
1046
|
+
* Removes hidden characters from a string.
|
|
1047
|
+
*
|
|
1048
|
+
* @param input - The input string to clean.
|
|
1049
|
+
* @returns {string} The cleaned string with hidden characters removed.
|
|
1050
|
+
*/
|
|
1051
|
+
const stripHiddenCharacters = (input) => {
|
|
1052
|
+
// Regular expression to match various hidden characters
|
|
1053
|
+
const hiddenRegex = new RegExp(
|
|
1054
|
+
// eslint-disable-next-line no-control-regex
|
|
1055
|
+
/[\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB\u0000-\u001F\u007F-\u009F]/gu);
|
|
1056
|
+
// Replace hidden characters with an empty string
|
|
1057
|
+
return input.replace(hiddenRegex, "");
|
|
1058
|
+
};
|
|
1045
1059
|
|
|
1046
1060
|
/* eslint-disable local-rules/prefer-custom-object-keys */
|
|
1047
1061
|
/* eslint-disable local-rules/prefer-custom-object-from-entries */
|
|
@@ -1065,4 +1079,4 @@ const isSorted = (sortInput) => {
|
|
|
1065
1079
|
return originalKeys.every((key, index) => key === sortedKeys[index]);
|
|
1066
1080
|
};
|
|
1067
1081
|
|
|
1068
|
-
export { DateTimeFormat, HoursAndMinutesFormat, align, alphabeticallySort, arrayLengthCompare, arrayNotEmpty, booleanCompare, capitalize, convertBlobToBase64, convertMetersToYards, convertYardsToMeters, dateCompare, deleteUndefinedKeys, difference, doNothing, enumFromValue, enumFromValueTypesafe, enumOrUndefinedFromValue, exhaustiveCheck, filterByMultiple, formatAddress, formatCoordinates, fuzzySearch, getDifferenceBetweenDates, getEndOfDay, getISOStringFromDate, getMultipleCoordinatesFromGeoJsonObject, getPointCoordinateFromGeoJsonObject, getResizedDimensions, getStartOfDay, groupBy, groupTinyDataToOthers, hourIntervals, intersection, isArrayEqual, isSorted, isUUID, isValidImage, nonNullable, numberCompare, numberCompareUnknownAfterHighest, objNotEmpty, objectEntries, objectFromEntries, objectKeys, objectValues, pick, removeLeftPadding, resizeBlob, resizeImage, size, stringCompare, stringCompareFromKey, stringNaturalCompare, titleCase, toID, toIDs, toUUID, trimIds, trimPath, truthy, unionArraysByKey };
|
|
1082
|
+
export { DateTimeFormat, HoursAndMinutesFormat, align, alphabeticallySort, arrayLengthCompare, arrayNotEmpty, booleanCompare, capitalize, convertBlobToBase64, convertMetersToYards, convertYardsToMeters, dateCompare, deleteUndefinedKeys, difference, doNothing, enumFromValue, enumFromValueTypesafe, enumOrUndefinedFromValue, exhaustiveCheck, filterByMultiple, formatAddress, formatCoordinates, fuzzySearch, getDifferenceBetweenDates, getEndOfDay, getISOStringFromDate, getMultipleCoordinatesFromGeoJsonObject, getPointCoordinateFromGeoJsonObject, getResizedDimensions, getStartOfDay, groupBy, groupTinyDataToOthers, hourIntervals, intersection, isArrayEqual, isSorted, isUUID, isValidImage, nonNullable, numberCompare, numberCompareUnknownAfterHighest, objNotEmpty, objectEntries, objectFromEntries, objectKeys, objectValues, pick, removeLeftPadding, resizeBlob, resizeImage, size, stringCompare, stringCompareFromKey, stringNaturalCompare, stripHiddenCharacters, titleCase, toID, toIDs, toUUID, trimIds, trimPath, truthy, unionArraysByKey };
|
package/package.json
CHANGED
package/src/stringUtils.d.ts
CHANGED
|
@@ -28,3 +28,10 @@ export declare const titleCase: (s: string) => string;
|
|
|
28
28
|
* @example removeLeftPadding("00000000-0000-0000-0000-000000000010") // 10
|
|
29
29
|
*/
|
|
30
30
|
export declare const removeLeftPadding: (id: string | null | undefined) => number;
|
|
31
|
+
/**
|
|
32
|
+
* Removes hidden characters from a string.
|
|
33
|
+
*
|
|
34
|
+
* @param input - The input string to clean.
|
|
35
|
+
* @returns {string} The cleaned string with hidden characters removed.
|
|
36
|
+
*/
|
|
37
|
+
export declare const stripHiddenCharacters: (input: string) => string;
|