@mll-lab/js-utils 2.17.1 → 2.19.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.js CHANGED
@@ -9491,6 +9491,20 @@ function sortByArray(subject, recipe) {
9491
9491
  }
9492
9492
  return lodash.sortBy(subject, (value) => recipe.indexOf(value));
9493
9493
  }
9494
+ /**
9495
+ * Takes a function that maps the values to sort and returns a compare function
9496
+ * using `String.prototype.localeCompare`, usable in `Array.sort` or similar APIs.
9497
+ *
9498
+ * null, undefined and the empty string are not distinguished and first in sort order.
9499
+ */
9500
+ function makeStringCompareFn(map) {
9501
+ return (a, b) => {
9502
+ var _a, _b;
9503
+ const mappedA = (_a = map(a)) !== null && _a !== void 0 ? _a : '';
9504
+ const mappedB = (_b = map(b)) !== null && _b !== void 0 ? _b : '';
9505
+ return mappedA.localeCompare(mappedB);
9506
+ };
9507
+ }
9494
9508
 
9495
9509
  function toInteger(dirtyNumber) {
9496
9510
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
@@ -15161,6 +15175,9 @@ function parseDotlessDate(value) {
15161
15175
  function formatDotlessDate(date) {
15162
15176
  return format(date, DOTLESS_DATE_FORMAT, { locale: de$1 });
15163
15177
  }
15178
+ function formatGermanTimeHourMinute(date) {
15179
+ return format(date, 'HH:mm');
15180
+ }
15164
15181
 
15165
15182
  /**
15166
15183
  * Detects if a mobile device is used
@@ -15458,6 +15475,7 @@ exports.formatGerman = formatGerman;
15458
15475
  exports.formatGermanDateTime = formatGermanDateTime;
15459
15476
  exports.formatGermanDotlessDate = formatGermanDotlessDate;
15460
15477
  exports.formatGermanNumber = formatGermanNumber;
15478
+ exports.formatGermanTimeHourMinute = formatGermanTimeHourMinute;
15461
15479
  exports.formatIsoDate = formatIsoDate;
15462
15480
  exports.formatIsoDateTime = formatIsoDateTime;
15463
15481
  exports.formatSecondlessDateTime = formatSecondlessDateTime;
@@ -15480,6 +15498,7 @@ exports.isURL = isURL;
15480
15498
  exports.isWord = isWord;
15481
15499
  exports.joinNonEmpty = joinNonEmpty;
15482
15500
  exports.last = last;
15501
+ exports.makeStringCompareFn = makeStringCompareFn;
15483
15502
  exports.mapSequentially = mapSequentially;
15484
15503
  exports.parseDate = parseDate;
15485
15504
  exports.parseDotlessDate = parseDotlessDate;