@mll-lab/js-utils 2.31.0 → 2.32.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
@@ -9527,6 +9527,13 @@ function makeStringCompareFn(map) {
9527
9527
  function localeCompareStrings(a, b) {
9528
9528
  return a.localeCompare(b);
9529
9529
  }
9530
+ /** If the given array contains exactly one item, return that, otherwise null. */
9531
+ function soleItem(array) {
9532
+ if (!array || array.length !== 1) {
9533
+ return null;
9534
+ }
9535
+ return array[0];
9536
+ }
9530
9537
 
9531
9538
  /**
9532
9539
  * @name toDate
@@ -15928,6 +15935,7 @@ exports.pick = pick;
15928
15935
  exports.pluralize = pluralize;
15929
15936
  exports.pxToNumber = pxToNumber;
15930
15937
  exports.round = round;
15938
+ exports.soleItem = soleItem;
15931
15939
  exports.sortByArray = sortByArray;
15932
15940
  exports.toggleElement = toggleElement;
15933
15941
  exports.withoutIndex = withoutIndex;