@trackunit/shared-utils 0.0.31 → 0.0.32

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 CHANGED
@@ -228,6 +228,16 @@ const nonNullable = (value) => {
228
228
  const truthy = (value) => {
229
229
  return !!value;
230
230
  };
231
+ /**
232
+ * Converts a string value to lowercase while preserving the original type.
233
+ *
234
+ * @param value - The string value to convert to lowercase.
235
+ * @returns {Lowercase<string> } The lowercase value with the same type as the input value.
236
+ */
237
+ const typeSafeToLowercase = (value) => {
238
+ // eslint-disable-next-line local-rules/no-typescript-assertion
239
+ return value.toLowerCase();
240
+ };
231
241
 
232
242
  /** toggle whether a value is in an array or not */
233
243
  function toggle(array, value) {
@@ -1018,4 +1028,5 @@ exports.toggle = toggle;
1018
1028
  exports.trimIds = trimIds;
1019
1029
  exports.trimPath = trimPath;
1020
1030
  exports.truthy = truthy;
1031
+ exports.typeSafeToLowercase = typeSafeToLowercase;
1021
1032
  exports.unionArraysByKey = unionArraysByKey;
package/index.esm.js CHANGED
@@ -224,6 +224,16 @@ const nonNullable = (value) => {
224
224
  const truthy = (value) => {
225
225
  return !!value;
226
226
  };
227
+ /**
228
+ * Converts a string value to lowercase while preserving the original type.
229
+ *
230
+ * @param value - The string value to convert to lowercase.
231
+ * @returns {Lowercase<string> } The lowercase value with the same type as the input value.
232
+ */
233
+ const typeSafeToLowercase = (value) => {
234
+ // eslint-disable-next-line local-rules/no-typescript-assertion
235
+ return value.toLowerCase();
236
+ };
227
237
 
228
238
  /** toggle whether a value is in an array or not */
229
239
  function toggle(array, value) {
@@ -960,4 +970,4 @@ const titleCase = (s) => {
960
970
  */
961
971
  const removeLeftPadding = (id) => Number(id === null || id === void 0 ? void 0 : id.replace(/-/g, "").replace(/^0+/, ""));
962
972
 
963
- export { DateTimeFormat, HoursAndMinutesFormat, align, arrayLengthCompare, arrayNotEmpty, booleanCompare, capitalize, convertBlobToBase64, convertMetersToYards, convertYardsToMeters, dateCompare, deleteUndefinedKeys, difference, doNothing, ensureArray, enumFromValue, enumFromValueTypesafe, enumOrUndefinedFromValue, exhaustiveCheck, filterByMultiple, formatAddress, formatCoordinates, fuzzySearch, getDifferenceBetweenDates, getEndOfDay, getISOStringFromDate, getMultipleCoordinatesFromGeoJsonObject, getPointCoordinateFromGeoJsonObject, getResizedDimensions, getStartOfDay, groupBy, groupTinyDataToOthers, hourIntervals, intersection, isStringArrayEqual, isUUID, isValidImage, nonNullable, numberCompare, numberCompareUnknownAfterHighest, objNotEmpty, removeLeftPadding, resizeBlob, resizeImage, size, stringCompare, stringCompareFromKey, stringNaturalCompare, titleCase, toID, toIDs, toUUID, toggle, trimIds, trimPath, truthy, unionArraysByKey };
973
+ export { DateTimeFormat, HoursAndMinutesFormat, align, arrayLengthCompare, arrayNotEmpty, booleanCompare, capitalize, convertBlobToBase64, convertMetersToYards, convertYardsToMeters, dateCompare, deleteUndefinedKeys, difference, doNothing, ensureArray, enumFromValue, enumFromValueTypesafe, enumOrUndefinedFromValue, exhaustiveCheck, filterByMultiple, formatAddress, formatCoordinates, fuzzySearch, getDifferenceBetweenDates, getEndOfDay, getISOStringFromDate, getMultipleCoordinatesFromGeoJsonObject, getPointCoordinateFromGeoJsonObject, getResizedDimensions, getStartOfDay, groupBy, groupTinyDataToOthers, hourIntervals, intersection, isStringArrayEqual, isUUID, isValidImage, nonNullable, numberCompare, numberCompareUnknownAfterHighest, objNotEmpty, removeLeftPadding, resizeBlob, resizeImage, size, stringCompare, stringCompareFromKey, stringNaturalCompare, titleCase, toID, toIDs, toUUID, toggle, trimIds, trimPath, truthy, typeSafeToLowercase, unionArraysByKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/shared-utils",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -52,4 +52,11 @@ export type MappedOmit<T, K extends keyof T> = {
52
52
  * @returns {Omit<BaseType, OptionalProp> & Partial<Pick<BaseType, OptionalProp>>} - A type with the specified property made optional.
53
53
  */
54
54
  export type MakePropertyOptional<BaseType, OptionalProp extends keyof BaseType> = MappedOmit<BaseType, OptionalProp> & Partial<Pick<BaseType, OptionalProp>>;
55
+ /**
56
+ * Converts a string value to lowercase while preserving the original type.
57
+ *
58
+ * @param value - The string value to convert to lowercase.
59
+ * @returns {Lowercase<string> } The lowercase value with the same type as the input value.
60
+ */
61
+ export declare const typeSafeToLowercase: <TStringLiteral extends string>(value: TStringLiteral) => Lowercase<TStringLiteral>;
55
62
  export {};