@dereekb/util 13.7.0 → 13.9.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/index.esm.js CHANGED
@@ -352,43 +352,33 @@ function _unsupported_iterable_to_array$A(o, minLen) {
352
352
  * @returns An array containing the tuple(s)
353
353
  * @throws Error if input is not an array
354
354
  */ function wrapTuples(input) {
355
- if (Array.isArray(input)) {
356
- // check if the first item is an array. Tuples can contain arrays as the first value.
357
- if (input.length > 0) {
358
- var firstValueInPotentialTupleOrArray = input[0];
359
- var inputIsSingleTuple = false;
360
- if (Array.isArray(firstValueInPotentialTupleOrArray)) {
361
- // if the first nested value is an array then the top-level value may be an array and not a tuple. Check the length of all the other values in the array to see if they have the same length.
362
- var expectedLength = firstValueInPotentialTupleOrArray.length;
363
- // if it is an array of tuples, all values should be the same length and be arrays. If not an array, then we're looking at a tuple.
364
- var firstNonUniformTupleValueIndex = input.findIndex(function(x) {
365
- if (Array.isArray(x)) {
366
- return x.length !== expectedLength;
367
- } else {
368
- return true; // non-array value. The input is a tuple.
369
- }
370
- });
371
- inputIsSingleTuple = firstNonUniformTupleValueIndex !== -1;
372
- } else {
373
- inputIsSingleTuple = true;
374
- return [
375
- input
376
- ];
377
- }
378
- // first value of the tuple could also be an array. If it is, check the other tuples all have the same length.
379
- if (inputIsSingleTuple) {
380
- return [
381
- input
382
- ];
383
- } else {
384
- return input;
385
- }
355
+ if (!Array.isArray(input)) {
356
+ throw new Error('Input is not an array/tuple...');
357
+ }
358
+ var result;
359
+ // check if the first item is an array. Tuples can contain arrays as the first value.
360
+ if (input.length > 0) {
361
+ var firstValueInPotentialTupleOrArray = input[0];
362
+ var inputIsSingleTuple = false;
363
+ if (Array.isArray(firstValueInPotentialTupleOrArray)) {
364
+ // if the first nested value is an array then the top-level value may be an array and not a tuple. Check the length of all the other values in the array to see if they have the same length.
365
+ var expectedLength = firstValueInPotentialTupleOrArray.length;
366
+ // if it is an array of tuples, all values should be the same length and be arrays. If not an array, then we're looking at a tuple.
367
+ var firstNonUniformTupleValueIndex = input.findIndex(function(x) {
368
+ return Array.isArray(x) ? x.length !== expectedLength : true; // non-array value means the input is a tuple.
369
+ });
370
+ inputIsSingleTuple = firstNonUniformTupleValueIndex !== -1;
386
371
  } else {
387
- return input; // is an empty array.
372
+ inputIsSingleTuple = true;
388
373
  }
374
+ // first value of the tuple could also be an array. If it is, check the other tuples all have the same length.
375
+ result = inputIsSingleTuple ? [
376
+ input
377
+ ] : input;
389
378
  } else {
390
- throw new Error('Input is not an array/tuple...');
379
+ result = input; // is an empty array.
391
380
  }
381
+ return result;
392
382
  }
393
383
 
394
384
  function _array_like_to_array$z(arr, len) {
@@ -438,11 +428,7 @@ function _unsupported_iterable_to_array$z(o, minLen) {
438
428
  * @param arrayOrValue - single value, array, or nullish value to convert
439
429
  * @returns the input wrapped in an array, the input array itself, or an empty array if nullish
440
430
  */ function convertMaybeToArray(arrayOrValue) {
441
- if (arrayOrValue != null) {
442
- return convertToArray(arrayOrValue);
443
- } else {
444
- return [];
445
- }
431
+ return arrayOrValue != null ? convertToArray(arrayOrValue) : [];
446
432
  }
447
433
  /**
448
434
  * Alias for {@link convertMaybeToArray}. Converts a maybe value or array into an array, returning an empty array for nullish input.
@@ -474,11 +460,7 @@ function _unsupported_iterable_to_array$z(o, minLen) {
474
460
  * @param input - single value or array to retrieve from
475
461
  * @returns the last element of the array, or the input value itself
476
462
  */ function lastValue(input) {
477
- if (Array.isArray(input)) {
478
- return input[input.length - 1];
479
- } else {
480
- return input;
481
- }
463
+ return Array.isArray(input) ? input[input.length - 1] : input;
482
464
  }
483
465
  /**
484
466
  * Returns a tuple with the first and last value of the input.
@@ -502,11 +484,7 @@ function _unsupported_iterable_to_array$z(o, minLen) {
502
484
  * @param index - zero-based index of the element to retrieve
503
485
  * @returns the element at the specified index, or the input value itself if not an array
504
486
  */ function valueAtIndex(input, index) {
505
- if (Array.isArray(input)) {
506
- return input[index];
507
- } else {
508
- return input;
509
- }
487
+ return Array.isArray(input) ? input[index] : input;
510
488
  }
511
489
  /**
512
490
  * Concatenates the input arrays into a single array, filtering out nullish entries.
@@ -600,10 +578,9 @@ function _unsupported_iterable_to_array$z(o, minLen) {
600
578
  */ function pushItemOrArrayItemsIntoArray(target, value) {
601
579
  if (Array.isArray(value)) {
602
580
  return pushArrayItemsIntoArray(target, value);
603
- } else {
604
- target.push(value);
605
- return target;
606
581
  }
582
+ target.push(value);
583
+ return target;
607
584
  }
608
585
  /**
609
586
  * Merges all elements from the source array into the target array using push.
@@ -717,18 +694,19 @@ function _unsupported_iterable_to_array$z(o, minLen) {
717
694
  * ```
718
695
  */ function readKeysFunction(readKey) {
719
696
  return function(values) {
697
+ var result;
720
698
  if (Array.isArray(values)) {
721
- var keys = [];
699
+ result = [];
722
700
  values.forEach(function(x) {
723
701
  var key = readKey(x);
724
702
  if (key != null) {
725
- pushItemOrArrayItemsIntoArray(keys, key);
703
+ pushItemOrArrayItemsIntoArray(result, key);
726
704
  }
727
705
  });
728
- return keys;
729
706
  } else {
730
- return asArray(readKey(values));
707
+ result = asArray(readKey(values));
731
708
  }
709
+ return result;
732
710
  };
733
711
  }
734
712
  /**
@@ -753,24 +731,25 @@ function _unsupported_iterable_to_array$z(o, minLen) {
753
731
  * ```
754
732
  */ function readKeysSetFunction(readKey) {
755
733
  return function(values) {
734
+ var result;
756
735
  if (Array.isArray(values)) {
757
- var keys = new Set();
736
+ result = new Set();
758
737
  values.forEach(function(x) {
759
738
  var key = readKey(x);
760
739
  if (key != null) {
761
740
  if (Array.isArray(key)) {
762
741
  key.forEach(function(x) {
763
- return keys.add(x);
742
+ return result.add(x);
764
743
  });
765
744
  } else {
766
- keys.add(key);
745
+ result.add(key);
767
746
  }
768
747
  }
769
748
  });
770
- return keys;
771
749
  } else {
772
- return new Set(asArray(readKey(values)));
750
+ result = new Set(asArray(readKey(values)));
773
751
  }
752
+ return result;
774
753
  };
775
754
  }
776
755
  /**
@@ -1249,13 +1228,9 @@ function _unsupported_iterable_to_array$y(o, minLen) {
1249
1228
  */ function setContainsAnyValue(valuesSet, valuesToFind) {
1250
1229
  var emptyValuesToFindArrayResult = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
1251
1230
  var valuesToFindArray = iterableToArray(valuesToFind);
1252
- if (valuesToFindArray.length > 0) {
1253
- return valuesToFindArray.some(function(x) {
1254
- return valuesSet.has(x);
1255
- });
1256
- } else {
1257
- return emptyValuesToFindArrayResult;
1258
- }
1231
+ return valuesToFindArray.length > 0 ? valuesToFindArray.some(function(x) {
1232
+ return valuesSet.has(x);
1233
+ }) : emptyValuesToFindArrayResult;
1259
1234
  }
1260
1235
  /**
1261
1236
  * Returns true if values contains all values in valuesToFind.
@@ -1282,13 +1257,9 @@ function _unsupported_iterable_to_array$y(o, minLen) {
1282
1257
  */ function setContainsAllValues(valuesSet, valuesToFind) {
1283
1258
  var emptyValuesToFindArrayResult = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
1284
1259
  var valuesToFindArray = iterableToArray(valuesToFind);
1285
- if (valuesToFindArray.length > 0) {
1286
- return !valuesToFindArray.some(function(x) {
1287
- return !valuesSet.has(x);
1288
- });
1289
- } else {
1290
- return emptyValuesToFindArrayResult;
1291
- }
1260
+ return valuesToFindArray.length > 0 ? !valuesToFindArray.some(function(x) {
1261
+ return !valuesSet.has(x);
1262
+ }) : emptyValuesToFindArrayResult;
1292
1263
  }
1293
1264
  /**
1294
1265
  * Returns true if both iterables are defined (or are both null/undefined) and have the same values exactly.
@@ -1342,20 +1313,16 @@ function _unsupported_iterable_to_array$x(o, minLen) {
1342
1313
  * @returns The inverted function, or the original if invert is false
1343
1314
  */ function invertBooleanReturnFunction(decisionFn) {
1344
1315
  var invert = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
1345
- if (invert) {
1346
- return function() {
1347
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1348
- args[_key] = arguments[_key];
1349
- }
1350
- var _decisionFn;
1351
- var result = (_decisionFn = decisionFn).call.apply(_decisionFn, [
1352
- undefined
1353
- ].concat(_to_consumable_array$k(args)));
1354
- return !result;
1355
- };
1356
- } else {
1357
- return decisionFn;
1358
- }
1316
+ return invert ? function() {
1317
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1318
+ args[_key] = arguments[_key];
1319
+ }
1320
+ var _decisionFn;
1321
+ var result = (_decisionFn = decisionFn).call.apply(_decisionFn, [
1322
+ undefined
1323
+ ].concat(_to_consumable_array$k(args)));
1324
+ return !result;
1325
+ } : decisionFn;
1359
1326
  }
1360
1327
 
1361
1328
  /**
@@ -1486,11 +1453,7 @@ function _type_of$l(obj) {
1486
1453
  * @param value - the value to check
1487
1454
  * @returns `true` if the value is non-nullish and not empty
1488
1455
  */ function hasValueOrNotEmpty(value) {
1489
- if (isIterable(value, false)) {
1490
- return !isEmptyIterable(value);
1491
- } else {
1492
- return isNotNullOrEmptyString(value);
1493
- }
1456
+ return isIterable(value, false) ? !isEmptyIterable(value) : isNotNullOrEmptyString(value);
1494
1457
  }
1495
1458
  /**
1496
1459
  * Type guard that checks whether the input has a meaningful value, including checking for empty objects.
@@ -1503,13 +1466,15 @@ function _type_of$l(obj) {
1503
1466
  * @param value - the value to check
1504
1467
  * @returns `true` if the value is non-nullish, non-empty, and not an empty object
1505
1468
  */ function hasValueOrNotEmptyObject(value) {
1469
+ var result;
1506
1470
  if (isIterable(value, true)) {
1507
- return !isEmptyIterable(value);
1471
+ result = !isEmptyIterable(value);
1508
1472
  } else if (isNotNullOrEmptyString(value)) {
1509
- return (typeof value === "undefined" ? "undefined" : _type_of$l(value)) === 'object' ? !objectHasNoKeys(value) : true;
1473
+ result = (typeof value === "undefined" ? "undefined" : _type_of$l(value)) === 'object' ? !objectHasNoKeys(value) : true;
1510
1474
  } else {
1511
- return false;
1475
+ result = false;
1512
1476
  }
1477
+ return result;
1513
1478
  }
1514
1479
  /**
1515
1480
  * Returns `true` if the input value is a non-empty string or is `true`.
@@ -1823,13 +1788,9 @@ function _type_of$l(obj) {
1823
1788
  }
1824
1789
  function chainMapFunction(a, b) {
1825
1790
  var apply = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
1826
- if (apply && b != null) {
1827
- return function(x) {
1828
- return b(a(x));
1829
- };
1830
- } else {
1831
- return a;
1832
- }
1791
+ return apply && b != null ? function(x) {
1792
+ return b(a(x));
1793
+ } : a;
1833
1794
  }
1834
1795
 
1835
1796
  function _array_like_to_array$w(arr, len) {
@@ -2784,24 +2745,23 @@ function reverseCompareFn(compareFn) {
2784
2745
  var _firstValueFromIterable;
2785
2746
  var min = (_firstValueFromIterable = firstValueFromIterable(values)) !== null && _firstValueFromIterable !== void 0 ? _firstValueFromIterable : undefined;
2786
2747
  var max = min;
2787
- if (min != null && max != null) {
2788
- forEachInIterable(values, function(x) {
2789
- var compareMin = compareFn(x, min);
2790
- var compareMax = compareFn(x, max);
2791
- if (compareMin < 0) {
2792
- min = x;
2793
- }
2794
- if (compareMax > 0) {
2795
- max = x;
2796
- }
2797
- });
2798
- return {
2799
- min: min,
2800
- max: max
2801
- };
2802
- } else {
2748
+ if (min == null || max == null) {
2803
2749
  return null;
2804
2750
  }
2751
+ forEachInIterable(values, function(x) {
2752
+ var compareMin = compareFn(x, min);
2753
+ var compareMax = compareFn(x, max);
2754
+ if (compareMin < 0) {
2755
+ min = x;
2756
+ }
2757
+ if (compareMax > 0) {
2758
+ max = x;
2759
+ }
2760
+ });
2761
+ return {
2762
+ min: min,
2763
+ max: max
2764
+ };
2805
2765
  };
2806
2766
  }
2807
2767
 
@@ -3425,11 +3385,7 @@ function _unsupported_iterable_to_array$r(o, minLen) {
3425
3385
  */ function bitwiseSetDencoder(maxIndex) {
3426
3386
  var decoder = maxIndex ? bitwiseSetDecoder(maxIndex) : dencodeBitwiseSet;
3427
3387
  return function(input) {
3428
- if (typeof input === 'number') {
3429
- return decoder(input);
3430
- } else {
3431
- return encodeBitwiseSet(input);
3432
- }
3388
+ return typeof input === 'number' ? decoder(input) : encodeBitwiseSet(input);
3433
3389
  };
3434
3390
  }
3435
3391
  /**
@@ -3469,11 +3425,7 @@ function _unsupported_iterable_to_array$r(o, minLen) {
3469
3425
  var encoder = bitwiseObjectEncoder(config.toSetFunction);
3470
3426
  var decoder = bitwiseObjectdecoder(config.fromSetFunction, config.maxIndex);
3471
3427
  return function(input) {
3472
- if (typeof input === 'number') {
3473
- return decoder(input);
3474
- } else {
3475
- return encoder(input);
3476
- }
3428
+ return typeof input === 'number' ? decoder(input) : encoder(input);
3477
3429
  };
3478
3430
  }
3479
3431
 
@@ -3531,11 +3483,7 @@ function _type_of$j(obj) {
3531
3483
  return isNonClassFunction(value);
3532
3484
  }
3533
3485
  function getValueFromGetter(input, args) {
3534
- if (isNonClassFunction(input)) {
3535
- return input(args);
3536
- } else {
3537
- return input;
3538
- }
3486
+ return isNonClassFunction(input) ? input(args) : input;
3539
3487
  }
3540
3488
  /**
3541
3489
  * Wraps the input as a Getter function. If it's already a function, returns it directly.
@@ -3543,13 +3491,9 @@ function getValueFromGetter(input, args) {
3543
3491
  * @param input - A value or getter function
3544
3492
  * @returns A Getter function that returns the value
3545
3493
  */ function asGetter(input) {
3546
- if (isNonClassFunction(input)) {
3494
+ return isNonClassFunction(input) ? input : function() {
3547
3495
  return input;
3548
- } else {
3549
- return function() {
3550
- return input;
3551
- };
3552
- }
3496
+ };
3553
3497
  }
3554
3498
  /**
3555
3499
  * Creates a factory that returns a shallow copy of the input value on each call.
@@ -3571,11 +3515,7 @@ function getValueFromGetter(input, args) {
3571
3515
  * @param copyFunction - Optional custom copy function
3572
3516
  * @returns An ObjectCopyFactory for the input
3573
3517
  */ function asObjectCopyFactory(input, copyFunction) {
3574
- if ((typeof input === "undefined" ? "undefined" : _type_of$j(input)) === 'object') {
3575
- return objectCopyFactory(input, copyFunction);
3576
- } else {
3577
- return asGetter(input);
3578
- }
3518
+ return (typeof input === "undefined" ? "undefined" : _type_of$j(input)) === 'object' ? objectCopyFactory(input, copyFunction) : asGetter(input);
3579
3519
  }
3580
3520
  /**
3581
3521
  * Wraps the input value in a Getter function that always returns it.
@@ -3678,13 +3618,15 @@ function makeWithFactoryInput(factory, input) {
3678
3618
  var distance = max - min;
3679
3619
  var isInBound = isInNumberBoundFunction(wrapNumberFunctionConfig);
3680
3620
  var fn = function fn(input) {
3621
+ var result;
3681
3622
  if (isInBound(input)) {
3682
- return input;
3623
+ result = input;
3683
3624
  } else {
3684
3625
  // when fencePosts is true, we're wrapping to the nearest fence post, meaning wraps are one value longer increased on that side.
3685
3626
  var fencePostOffset = fencePosts ? input < min ? 1 : -1 : 0;
3686
- return ((input - min) % distance + distance) % distance + min + fencePostOffset;
3627
+ result = ((input - min) % distance + distance) % distance + min + fencePostOffset;
3687
3628
  }
3629
+ return result;
3688
3630
  };
3689
3631
  fn._wrap = wrapNumberFunctionConfig;
3690
3632
  return fn;
@@ -3698,13 +3640,9 @@ function makeWithFactoryInput(factory, input) {
3698
3640
  * @returns A function that bounds input numbers into the configured range
3699
3641
  */ function boundNumberFunction(boundNumberFunctionConfig) {
3700
3642
  var min = boundNumberFunctionConfig.min, max = boundNumberFunctionConfig.max, wrap = boundNumberFunctionConfig.wrap;
3701
- if (wrap) {
3702
- return wrapNumberFunction(boundNumberFunctionConfig);
3703
- } else {
3704
- return function(input) {
3705
- return boundNumber(input, min, max);
3706
- };
3707
- }
3643
+ return wrap ? wrapNumberFunction(boundNumberFunctionConfig) : function(input) {
3644
+ return boundNumber(input, min, max);
3645
+ };
3708
3646
  }
3709
3647
  /**
3710
3648
  * Clamps the input number between the min and max values (inclusive).
@@ -3931,16 +3869,18 @@ function _type_of$h(obj) {
3931
3869
  * @returns A function that rounds numbers to the configured precision
3932
3870
  */ function roundToPrecisionFunction(precision) {
3933
3871
  var roundFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 'round';
3872
+ var result;
3934
3873
  if (roundFn === 'cut') {
3935
- return function(value) {
3874
+ result = function result(value) {
3936
3875
  return cutToPrecision(value, precision);
3937
3876
  };
3938
3877
  } else {
3939
3878
  var rndFn = roundingFunction(roundFn);
3940
- return function(value) {
3879
+ result = function result(value) {
3941
3880
  return +(rndFn(Number(value + 'e+' + precision)) + 'e-' + precision);
3942
3881
  };
3943
3882
  }
3883
+ return result;
3944
3884
  }
3945
3885
  /**
3946
3886
  * Rounds a number to the specified decimal precision using `Math.round`.
@@ -4028,11 +3968,7 @@ var DOLLAR_AMOUNT_STRING_REGEX = /^\$?([0-9]+)\.?([0-9][0-9])$/;
4028
3968
  * @param number - The dollar amount to format
4029
3969
  * @returns Formatted string with two decimal places (e.g., "12.50")
4030
3970
  */ function dollarAmountString(number) {
4031
- if (number) {
4032
- return cutToPrecision(number, DOLLAR_AMOUNT_PRECISION).toFixed(DOLLAR_AMOUNT_PRECISION);
4033
- } else {
4034
- return '0.00';
4035
- }
3971
+ return number ? cutToPrecision(number, DOLLAR_AMOUNT_PRECISION).toFixed(DOLLAR_AMOUNT_PRECISION) : '0.00';
4036
3972
  }
4037
3973
  /**
4038
3974
  * Creates a function that formats dollar amounts as strings with a unit prefix (e.g., "$12.50").
@@ -4289,11 +4225,7 @@ var DOLLAR_AMOUNT_STRING_REGEX = /^\$?([0-9]+)\.?([0-9][0-9])$/;
4289
4225
  * @param emptyArrayValue - value to return when the array is empty
4290
4226
  * @returns the reduced result, or the empty array value if the array is empty
4291
4227
  */ function reduceNumbers(reduceFn, array, emptyArrayValue) {
4292
- if (array.length === 0) {
4293
- return emptyArrayValue;
4294
- } else {
4295
- return reduceNumbersFn(reduceFn, emptyArrayValue)(array);
4296
- }
4228
+ return array.length === 0 ? emptyArrayValue : reduceNumbersFn(reduceFn, emptyArrayValue)(array);
4297
4229
  }
4298
4230
  function reduceNumbersFn(reduceFn, emptyArrayValue) {
4299
4231
  var rFn = function rFn(array) {
@@ -4460,11 +4392,7 @@ function reduceNumbersFn(reduceFn, emptyArrayValue) {
4460
4392
  return function(values) {
4461
4393
  var minMax = findMinMax(values);
4462
4394
  var max = minMax === null || minMax === void 0 ? void 0 : minMax.max;
4463
- if (max != null) {
4464
- return readNextIndex(max);
4465
- } else {
4466
- return 0;
4467
- }
4395
+ return max != null ? readNextIndex(max) : 0;
4468
4396
  };
4469
4397
  }
4470
4398
  /**
@@ -4480,11 +4408,7 @@ function reduceNumbersFn(reduceFn, emptyArrayValue) {
4480
4408
  }; //return the max index + 1 by default.
4481
4409
  return function(sortedValues) {
4482
4410
  var lastValueInSorted = lastValue(sortedValues);
4483
- if (lastValueInSorted != null) {
4484
- return readNextIndex(lastValueInSorted);
4485
- } else {
4486
- return 0;
4487
- }
4411
+ return lastValueInSorted != null ? readNextIndex(lastValueInSorted) : 0;
4488
4412
  };
4489
4413
  }
4490
4414
  /**
@@ -4503,15 +4427,10 @@ function reduceNumbersFn(reduceFn, emptyArrayValue) {
4503
4427
  var minAndMaxItems = minAndMaxIndexItemsFunction(readIndex);
4504
4428
  var fn = function fn(values) {
4505
4429
  var result = minAndMaxItems(values);
4506
- if (result != null) {
4507
- var min = result.min, max = result.max;
4508
- return {
4509
- min: readIndex(min),
4510
- max: readIndex(max)
4511
- };
4512
- } else {
4513
- return null;
4514
- }
4430
+ return result != null ? {
4431
+ min: readIndex(result.min),
4432
+ max: readIndex(result.max)
4433
+ } : null;
4515
4434
  };
4516
4435
  fn._readIndex = readIndex;
4517
4436
  return fn;
@@ -4642,11 +4561,7 @@ function reduceNumbersFn(reduceFn, emptyArrayValue) {
4642
4561
  var ra = readIndexRange(a);
4643
4562
  var rb = readIndexRange(b);
4644
4563
  var comp = ra.minIndex - rb.minIndex; // sort by smaller minIndexes first
4645
- if (comp === 0) {
4646
- return ra.maxIndex - rb.maxIndex; // sort by larger maxIndexes first
4647
- } else {
4648
- return comp;
4649
- }
4564
+ return comp === 0 ? ra.maxIndex - rb.maxIndex : comp; // sort by larger maxIndexes first when equal
4650
4565
  };
4651
4566
  }
4652
4567
  /**
@@ -4670,14 +4585,10 @@ function reduceNumbersFn(reduceFn, emptyArrayValue) {
4670
4585
  * @param input - a single index number or an IndexRange
4671
4586
  * @returns the normalized IndexRange
4672
4587
  */ function indexRange(input) {
4673
- if (typeof input === 'number') {
4674
- return {
4675
- minIndex: input,
4676
- maxIndex: input + 1
4677
- };
4678
- } else {
4679
- return input;
4680
- }
4588
+ return typeof input === 'number' ? {
4589
+ minIndex: input,
4590
+ maxIndex: input + 1
4591
+ } : input;
4681
4592
  }
4682
4593
  /**
4683
4594
  * Creates a {@link FitToIndexRangeFunction} that clamps index numbers to the given range boundaries.
@@ -4728,16 +4639,15 @@ function indexRangeCheckReaderFunction(input) {
4728
4639
  }
4729
4640
  function indexRangeCheckFunctionConfigToIndexRange(param) {
4730
4641
  var indexRange = param.indexRange, inclusiveMaxIndex = param.inclusiveMaxIndex;
4731
- if (inclusiveMaxIndex) {
4732
- var minIndex = indexRange.minIndex, maxIndexInput = indexRange.maxIndex;
4733
- var maxIndex = maxIndexInput + 1;
4734
- return {
4735
- minIndex: minIndex,
4736
- maxIndex: maxIndex
4737
- };
4738
- } else {
4642
+ if (!inclusiveMaxIndex) {
4739
4643
  return indexRange;
4740
4644
  }
4645
+ var minIndex = indexRange.minIndex, maxIndexInput = indexRange.maxIndex;
4646
+ var maxIndex = maxIndexInput + 1;
4647
+ return {
4648
+ minIndex: minIndex,
4649
+ maxIndex: maxIndex
4650
+ };
4741
4651
  }
4742
4652
  /**
4743
4653
  * Normalizes an {@link IndexRangeFunctionInput} to a full {@link IndexRangeFunctionConfig},
@@ -5272,65 +5182,59 @@ function getArrayNextIndex(array, index) {
5272
5182
  return function() {
5273
5183
  return {};
5274
5184
  }; // no pairs to match on
5275
- } else {
5276
- // pairs sorted in ascending order
5277
- var pairs = values.map(pairFactory).sort(sortByIndexRangeAscendingCompareFunction(function(x) {
5278
- return x.range;
5279
- }));
5280
- return function(index) {
5281
- // find the first item that fits the
5282
- var matchIndex = -1;
5283
- var i;
5284
- for(i = 0; i < pairs.length; i += 1){
5285
- var comparison = pairs[i];
5286
- if (comparison.range.minIndex <= index) {
5287
- if (comparison.range.maxIndex > index) {
5288
- matchIndex = i;
5289
- break;
5290
- }
5291
- // continue otherwise.
5292
- } else {
5293
- break; // outside the min index, is not within these values at all
5185
+ }
5186
+ // pairs sorted in ascending order
5187
+ var pairs = values.map(pairFactory).sort(sortByIndexRangeAscendingCompareFunction(function(x) {
5188
+ return x.range;
5189
+ }));
5190
+ return function(index) {
5191
+ // find the first item that fits the
5192
+ var matchIndex = -1;
5193
+ var i;
5194
+ for(i = 0; i < pairs.length; i += 1){
5195
+ var comparison = pairs[i];
5196
+ if (comparison.range.minIndex <= index) {
5197
+ if (comparison.range.maxIndex > index) {
5198
+ matchIndex = i;
5199
+ break;
5294
5200
  }
5295
- }
5296
- var match;
5297
- var prev;
5298
- var next;
5299
- if (matchIndex === -1) {
5300
- var _pairs_, _pairs_i;
5301
- // no match
5302
- match = undefined;
5303
- // use i otherwise
5304
- prev = (_pairs_ = pairs[i - 1]) === null || _pairs_ === void 0 ? void 0 : _pairs_.value;
5305
- next = (_pairs_i = pairs[i]) === null || _pairs_i === void 0 ? void 0 : _pairs_i.value;
5201
+ // continue otherwise.
5306
5202
  } else {
5307
- var _pairs_matchIndex, _pairs_1, _pairs_2;
5308
- match = (_pairs_matchIndex = pairs[matchIndex]) === null || _pairs_matchIndex === void 0 ? void 0 : _pairs_matchIndex.value;
5309
- prev = (_pairs_1 = pairs[matchIndex - 1]) === null || _pairs_1 === void 0 ? void 0 : _pairs_1.value;
5310
- next = (_pairs_2 = pairs[matchIndex + 1]) === null || _pairs_2 === void 0 ? void 0 : _pairs_2.value;
5203
+ break; // outside the min index, is not within these values at all
5311
5204
  }
5312
- var info = {
5313
- prev: prev,
5314
- match: match,
5315
- next: next
5316
- };
5317
- return info;
5205
+ }
5206
+ var match;
5207
+ var prev;
5208
+ var next;
5209
+ if (matchIndex === -1) {
5210
+ var _pairs_, _pairs_i;
5211
+ // no match
5212
+ match = undefined;
5213
+ // use i otherwise
5214
+ prev = (_pairs_ = pairs[i - 1]) === null || _pairs_ === void 0 ? void 0 : _pairs_.value;
5215
+ next = (_pairs_i = pairs[i]) === null || _pairs_i === void 0 ? void 0 : _pairs_i.value;
5216
+ } else {
5217
+ var _pairs_matchIndex, _pairs_1, _pairs_2;
5218
+ match = (_pairs_matchIndex = pairs[matchIndex]) === null || _pairs_matchIndex === void 0 ? void 0 : _pairs_matchIndex.value;
5219
+ prev = (_pairs_1 = pairs[matchIndex - 1]) === null || _pairs_1 === void 0 ? void 0 : _pairs_1.value;
5220
+ next = (_pairs_2 = pairs[matchIndex + 1]) === null || _pairs_2 === void 0 ? void 0 : _pairs_2.value;
5221
+ }
5222
+ var info = {
5223
+ prev: prev,
5224
+ match: match,
5225
+ next: next
5318
5226
  };
5319
- }
5227
+ return info;
5228
+ };
5320
5229
  };
5321
5230
  }
5322
5231
 
5323
5232
  function limitArray(array, inputConfig) {
5324
5233
  if (array && (inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.limit) != null) {
5325
5234
  var limit = inputConfig.limit, limitFromEnd = inputConfig.limitFromEnd;
5326
- if (limitFromEnd) {
5327
- return takeLast(array, limit);
5328
- } else {
5329
- return takeFront(array, limit);
5330
- }
5331
- } else {
5332
- return array;
5235
+ return limitFromEnd ? takeLast(array, limit) : takeFront(array, limit);
5333
5236
  }
5237
+ return array;
5334
5238
  }
5335
5239
 
5336
5240
  /**
@@ -5415,12 +5319,7 @@ function generateIfDoesNotExist(keys, existing, readKey, generateFn) {
5415
5319
  * @param values - array to generate a random index for
5416
5320
  * @returns a random valid index within the array, or 0 if the array is empty
5417
5321
  */ function randomArrayIndex(values) {
5418
- if (values.length === 0) {
5419
- return 0;
5420
- } else {
5421
- var random = Math.random();
5422
- return Math.round(random * (values.length - 1));
5423
- }
5322
+ return values.length === 0 ? 0 : Math.round(Math.random() * (values.length - 1));
5424
5323
  }
5425
5324
  /**
5426
5325
  * Picks a single item randomly from the input array.
@@ -5467,12 +5366,11 @@ function generateIfDoesNotExist(keys, existing, readKey, generateFn) {
5467
5366
  */ function findIndexOfFirstDuplicateValue(values) {
5468
5367
  var encountered = new Set();
5469
5368
  return values.findIndex(function(x) {
5470
- if (encountered.has(x)) {
5471
- return true;
5472
- } else {
5369
+ var isDuplicate = encountered.has(x);
5370
+ if (!isDuplicate) {
5473
5371
  encountered.add(x);
5474
- return false;
5475
5372
  }
5373
+ return isDuplicate;
5476
5374
  });
5477
5375
  }
5478
5376
 
@@ -5603,11 +5501,7 @@ function caseInsensitiveString(input) {
5603
5501
  * @returns the prefixed string, or undefined if the input is null/undefined
5604
5502
  */ function addPlusPrefixToNumber(value) {
5605
5503
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '+';
5606
- if (value != null) {
5607
- return value > 0 ? "".concat(prefix).concat(value) : "".concat(value);
5608
- } else {
5609
- return undefined;
5610
- }
5504
+ return value != null ? value > 0 ? "".concat(prefix).concat(value) : "".concat(value) : undefined;
5611
5505
  }
5612
5506
  /**
5613
5507
  * Capitalizes the first letter of the input string.
@@ -5894,30 +5788,29 @@ function caseInsensitiveString(input) {
5894
5788
  var fromStart = config.fromStart, fromEnd = config.fromEnd;
5895
5789
  var takeFromStart = Math.abs(fromStart !== null && fromStart !== void 0 ? fromStart : 0);
5896
5790
  var takeFromEnd = Math.abs(fromEnd !== null && fromEnd !== void 0 ? fromEnd : 0);
5791
+ var result;
5897
5792
  if (fromStart && fromEnd) {
5898
- return function(input) {
5793
+ result = function result(input) {
5899
5794
  var totalTake = takeFromStart + takeFromEnd;
5900
- var result;
5901
5795
  if (totalTake >= input.length) {
5902
- result = input;
5903
- } else {
5904
- var startPart = input.slice(0, takeFromStart);
5905
- var endPart = input.slice(-takeFromEnd);
5906
- result = startPart + endPart;
5796
+ return input;
5907
5797
  }
5908
- return result;
5798
+ var startPart = input.slice(0, takeFromStart);
5799
+ var endPart = input.slice(-takeFromEnd);
5800
+ return startPart + endPart;
5909
5801
  };
5910
5802
  } else if (fromStart) {
5911
- return function(input) {
5803
+ result = function result(input) {
5912
5804
  return input.slice(0, takeFromStart);
5913
5805
  };
5914
5806
  } else if (fromEnd) {
5915
- return function(input) {
5807
+ result = function result(input) {
5916
5808
  return input.slice(-takeFromEnd);
5917
5809
  };
5918
5810
  } else {
5919
- return MAP_IDENTITY;
5811
+ result = MAP_IDENTITY;
5920
5812
  }
5813
+ return result;
5921
5814
  }
5922
5815
 
5923
5816
  /**
@@ -5955,11 +5848,7 @@ function caseInsensitiveString(input) {
5955
5848
  * @returns a function that applies the configured transformations to an array of strings
5956
5849
  */ function transformStrings(config) {
5957
5850
  var transform = transformStringFunction(config);
5958
- if (isMapIdentityFunction(transform)) {
5959
- return mapIdentityFunction();
5960
- } else {
5961
- return mapArrayFunction(transform);
5962
- }
5851
+ return isMapIdentityFunction(transform) ? mapIdentityFunction() : mapArrayFunction(transform);
5963
5852
  }
5964
5853
  /**
5965
5854
  * Converts an iterable of strings to a lowercase string array for case-insensitive operations.
@@ -6055,19 +5944,15 @@ function caseInsensitiveString(input) {
6055
5944
  var exclude = excludeInput ? asArray(excludeInput) : undefined;
6056
5945
  var transform = transformStrings(config);
6057
5946
  var caseInsensitiveCompare = config.caseInsensitive && !config.toLowercase && !config.toUppercase;
6058
- if (caseInsensitiveCompare) {
6059
- // transform after finding unique values
6060
- return function(input) {
6061
- return transform(filterUniqueCaseInsensitiveStrings(input, function(x) {
6062
- return x;
6063
- }, exclude));
6064
- };
6065
- } else {
6066
- // transform before, and then use a set to find unique values
6067
- return function(input) {
6068
- return unique(transform(input), exclude);
6069
- };
6070
- }
5947
+ // When case-insensitive compare is needed, transform after finding unique values.
5948
+ // Otherwise, transform before and then use a set to find unique values.
5949
+ return caseInsensitiveCompare ? function(input) {
5950
+ return transform(filterUniqueCaseInsensitiveStrings(input, function(x) {
5951
+ return x;
5952
+ }, exclude));
5953
+ } : function(input) {
5954
+ return unique(transform(input), exclude);
5955
+ };
6071
5956
  }
6072
5957
 
6073
5958
  function _assert_this_initialized$4(self) {
@@ -6583,14 +6468,16 @@ function _unsupported_iterable_to_array$q(o, minLen) {
6583
6468
  * // tuples: [['a', 1], ['c', 'hello']]
6584
6469
  * ```
6585
6470
  */ function filterKeyValueTuplesFunction(filter) {
6471
+ var result;
6586
6472
  if (filter != null) {
6587
6473
  var filterFn = filterKeyValueTupleFunction(filter);
6588
- return function(obj) {
6474
+ result = function result(obj) {
6589
6475
  return allKeyValueTuples(obj).filter(filterFn);
6590
6476
  };
6591
6477
  } else {
6592
- return allKeyValueTuples;
6478
+ result = allKeyValueTuples;
6593
6479
  }
6480
+ return result;
6594
6481
  }
6595
6482
  /**
6596
6483
  * Returns all key/value pairs from the object as tuples using `Object.entries`.
@@ -6643,13 +6530,9 @@ function _unsupported_iterable_to_array$q(o, minLen) {
6643
6530
  * @param input - Enum value or filter object
6644
6531
  * @returns Normalized filter object
6645
6532
  */ function filterKeyValueTuplesInputToFilter(input) {
6646
- if ((typeof input === "undefined" ? "undefined" : _type_of$f(input)) === 'object') {
6647
- return input;
6648
- } else {
6649
- return {
6650
- valueFilter: input
6651
- };
6652
- }
6533
+ return (typeof input === "undefined" ? "undefined" : _type_of$f(input)) === 'object' ? input : {
6534
+ valueFilter: input
6535
+ };
6653
6536
  }
6654
6537
  /**
6655
6538
  * Creates a filter predicate function for key/value tuples based on the provided filter configuration.
@@ -6771,6 +6654,9 @@ function cachedGetter(factory) {
6771
6654
  return loaded = undefined;
6772
6655
  };
6773
6656
  result.init = init;
6657
+ result.used = function() {
6658
+ return Boolean(loaded);
6659
+ };
6774
6660
  return result;
6775
6661
  }
6776
6662
 
@@ -7664,11 +7550,7 @@ function isInSetDecisionFunction(set, inputReadValue) {
7664
7550
  * @param input
7665
7551
  * @returns
7666
7552
  */ function maybeSet(input) {
7667
- if (input != null) {
7668
- return new Set(asArray(input));
7669
- } else {
7670
- return input;
7671
- }
7553
+ return input != null ? new Set(asArray(input)) : input;
7672
7554
  }
7673
7555
 
7674
7556
  function _array_like_to_array$o(arr, len) {
@@ -7772,11 +7654,7 @@ var AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE = null;
7772
7654
  return claimsValue;
7773
7655
  },
7774
7656
  decodeRolesFromValue: function decodeRolesFromValue(value) {
7775
- if (value === expectedValue) {
7776
- return [];
7777
- } else {
7778
- return claimRoles;
7779
- }
7657
+ return value === expectedValue ? [] : claimRoles;
7780
7658
  }
7781
7659
  };
7782
7660
  } else {
@@ -7791,11 +7669,7 @@ var AUTH_ROLE_CLAIMS_DEFAULT_EMPTY_VALUE = null;
7791
7669
  return claimsValue;
7792
7670
  },
7793
7671
  decodeRolesFromValue: function decodeRolesFromValue(value) {
7794
- if (value === expectedValue) {
7795
- return claimRoles;
7796
- } else {
7797
- return [];
7798
- }
7672
+ return value === expectedValue ? claimRoles : [];
7799
7673
  }
7800
7674
  };
7801
7675
  }
@@ -8016,11 +7890,7 @@ function _unsupported_iterable_to_array$n(o, minLen) {
8016
7890
  * @returns the modified string, or the original if the decision is false
8017
7891
  */ // eslint-disable-next-line @typescript-eslint/max-params
8018
7892
  function replaceCharacterAtIndexIf(input, index, replacement, decision) {
8019
- if (decision(input[index])) {
8020
- return replaceCharacterAtIndexWith(input, index, replacement);
8021
- } else {
8022
- return input;
8023
- }
7893
+ return decision(input[index]) ? replaceCharacterAtIndexWith(input, index, replacement) : input;
8024
7894
  }
8025
7895
  /**
8026
7896
  * Replaces the character at the given index with the replacement string.
@@ -8568,11 +8438,7 @@ function _unsupported_iterable_to_array$m(o, minLen) {
8568
8438
  */ function asDecisionFunction(valueOrFunction) {
8569
8439
  var defaultIfUndefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
8570
8440
  var input = valueOrFunction !== null && valueOrFunction !== void 0 ? valueOrFunction : defaultIfUndefined;
8571
- if (typeof input === 'boolean') {
8572
- return decisionFunction(input);
8573
- } else {
8574
- return input;
8575
- }
8441
+ return typeof input === 'boolean' ? decisionFunction(input) : input;
8576
8442
  }
8577
8443
  function isEqualToValueDecisionFunction(equalityValue) {
8578
8444
  var equalityValueCheckFunction;
@@ -9043,11 +8909,7 @@ var ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX = /\.+/g;
9043
8909
  if (isFolder) {
9044
8910
  joined = joined + SLASH_PATH_SEPARATOR; // end with a slash.
9045
8911
  }
9046
- if (startType === 'absolute' || path.startsWith(SLASH_PATH_SEPARATOR)) {
9047
- return toAbsoluteSlashPathStartType(joined);
9048
- } else {
9049
- return joined;
9050
- }
8912
+ return startType === 'absolute' || path.startsWith(SLASH_PATH_SEPARATOR) ? toAbsoluteSlashPathStartType(joined) : joined;
9051
8913
  };
9052
8914
  }
9053
8915
  /**
@@ -9715,11 +9577,7 @@ function _unsupported_iterable_to_array$k(o, minLen) {
9715
9577
  * @returns A `tel:` URL string with the extension appended using `;` if present.
9716
9578
  */ function telUrlStringForE164PhoneNumberPair(pair) {
9717
9579
  // https://stackoverflow.com/questions/9482633/how-do-i-include-extensions-in-the-tel-uri
9718
- if (pair.extension) {
9719
- return "tel:".concat(pair.number, ";").concat(pair.extension);
9720
- } else {
9721
- return "tel:".concat(pair.number);
9722
- }
9580
+ return pair.extension ? "tel:".concat(pair.number, ";").concat(pair.extension) : "tel:".concat(pair.number);
9723
9581
  }
9724
9582
 
9725
9583
  /**
@@ -9831,19 +9689,21 @@ function _unsupported_iterable_to_array$j(o, minLen) {
9831
9689
  * @returns A combined array of EmailParticipant objects
9832
9690
  */ function coerceToEmailParticipants(param) {
9833
9691
  var _param_participants = param.participants, participants = _param_participants === void 0 ? [] : _param_participants, _param_emails = param.emails, emails = _param_emails === void 0 ? [] : _param_emails;
9692
+ var result;
9834
9693
  if (!emails.length) {
9835
- return participants;
9694
+ result = participants;
9836
9695
  } else {
9837
9696
  var participantEmails = participants.map(function(x) {
9838
9697
  return x.email;
9839
9698
  });
9840
9699
  var emailsWithoutParticipants = excludeValuesFromArray(emails, participantEmails);
9841
- return _to_consumable_array$b(participants).concat(_to_consumable_array$b(emailsWithoutParticipants.map(function(email) {
9700
+ result = _to_consumable_array$b(participants).concat(_to_consumable_array$b(emailsWithoutParticipants.map(function(email) {
9842
9701
  return {
9843
9702
  email: email
9844
9703
  };
9845
9704
  })));
9846
9705
  }
9706
+ return result;
9847
9707
  }
9848
9708
 
9849
9709
  /**
@@ -11046,16 +10906,15 @@ function _unsupported_iterable_to_array$f(o, minLen) {
11046
10906
  return filterMaybeArrayValues(input.map(function(x) {
11047
10907
  return map.get(x);
11048
10908
  }));
11049
- } else {
11050
- var value = map.get(input);
10909
+ }
10910
+ var value = map.get(input);
10911
+ if (value == null) {
10912
+ value = defaultValue(input);
11051
10913
  if (value == null) {
11052
- value = defaultValue(input);
11053
- if (value == null) {
11054
- throw new Error("Encountered unknown value ".concat(input, " in primativeKeyDencoder."));
11055
- }
10914
+ throw new Error("Encountered unknown value ".concat(input, " in primativeKeyDencoder."));
11056
10915
  }
11057
- return value;
11058
10916
  }
10917
+ return value;
11059
10918
  };
11060
10919
  fn._map = map;
11061
10920
  return fn;
@@ -11098,10 +10957,9 @@ function _unsupported_iterable_to_array$f(o, minLen) {
11098
10957
  if (typeof input === 'string') {
11099
10958
  var split = splitEncodedValues(input);
11100
10959
  return dencoder(split);
11101
- } else {
11102
- var encoded = dencoder(input);
11103
- return encoded.join(joiner);
11104
10960
  }
10961
+ var encoded = dencoder(input);
10962
+ return encoded.join(joiner);
11105
10963
  };
11106
10964
  }
11107
10965
  /**
@@ -12401,11 +12259,7 @@ function _unsupported_iterable_to_array$d(o, minLen) {
12401
12259
  * @returns a function that returns `true` if the input is within the reference bound
12402
12260
  */ function isWithinLatLngBoundFunction(bound) {
12403
12261
  var fn = function fn(boundOrPoint) {
12404
- if (isLatLngPoint(boundOrPoint)) {
12405
- return isLatLngPointWithinLatLngBound(boundOrPoint, bound);
12406
- } else {
12407
- return isLatLngBoundWithinLatLngBound(boundOrPoint, bound);
12408
- }
12262
+ return isLatLngPoint(boundOrPoint) ? isLatLngPointWithinLatLngBound(boundOrPoint, bound) : isLatLngBoundWithinLatLngBound(boundOrPoint, bound);
12409
12263
  };
12410
12264
  fn._bound = bound;
12411
12265
  return fn;
@@ -12437,15 +12291,14 @@ function _unsupported_iterable_to_array$d(o, minLen) {
12437
12291
  var sw = within.sw, ne = within.ne;
12438
12292
  var lat = point.lat, lng = point.lng;
12439
12293
  var latIsBounded = lat >= sw.lat && lat <= ne.lat;
12440
- if (latIsBounded) {
12441
- if (latLngBoundStrictlyWrapsMap(within)) {
12442
- // included if between sw to the max possible value/bound (180), and ne to the min possible value/bound (-180)
12443
- return lng >= sw.lng || lng <= ne.lng;
12444
- } else {
12445
- return lng >= sw.lng && lng <= ne.lng;
12446
- }
12294
+ if (!latIsBounded) {
12295
+ return false;
12447
12296
  }
12448
- return false;
12297
+ if (latLngBoundStrictlyWrapsMap(within)) {
12298
+ // included if between sw to the max possible value/bound (180), and ne to the min possible value/bound (-180)
12299
+ return lng >= sw.lng || lng <= ne.lng;
12300
+ }
12301
+ return lng >= sw.lng && lng <= ne.lng;
12449
12302
  }
12450
12303
  /**
12451
12304
  * Checks whether two bounds overlap each other.
@@ -12466,11 +12319,7 @@ function _unsupported_iterable_to_array$d(o, minLen) {
12466
12319
  */ function overlapsLatLngBoundFunction(bound) {
12467
12320
  var a = boundToRectangle(bound);
12468
12321
  var fn = function fn(boundOrPoint) {
12469
- if (isLatLngPoint(boundOrPoint)) {
12470
- return isLatLngPointWithinLatLngBound(boundOrPoint, bound);
12471
- } else {
12472
- return rectangleOverlapsRectangle(a, boundToRectangle(boundOrPoint));
12473
- }
12322
+ return isLatLngPoint(boundOrPoint) ? isLatLngPointWithinLatLngBound(boundOrPoint, bound) : rectangleOverlapsRectangle(a, boundToRectangle(boundOrPoint));
12474
12323
  };
12475
12324
  fn._bound = bound;
12476
12325
  return fn;
@@ -12790,13 +12639,15 @@ function isConsideredUtcTimezoneString(timezone) {
12790
12639
  return "".concat(year, "-").concat(month, "-").concat(day);
12791
12640
  }
12792
12641
  function dateFromDateOrTimeMillisecondsNumber(input) {
12642
+ var result;
12793
12643
  if (input == null) {
12794
- return input;
12644
+ result = input;
12795
12645
  } else if (isDate(input)) {
12796
- return input;
12646
+ result = input;
12797
12647
  } else {
12798
- return unixMillisecondsNumberToDate(input);
12648
+ result = unixMillisecondsNumberToDate(input);
12799
12649
  }
12650
+ return result;
12800
12651
  }
12801
12652
  /**
12802
12653
  * Converts a unix timestamp number to a Date object.
@@ -13906,28 +13757,29 @@ function _object_spread$7(target) {
13906
13757
  * @param b - Second array (or single value) of partial objects
13907
13758
  * @returns 2D array where result[i][j] is `{ ...a[i], ...b[j] }`
13908
13759
  */ function objectMergeMatrix(a, b) {
13760
+ var result;
13909
13761
  if (a && b) {
13910
13762
  var aNorm = convertToArray(a);
13911
13763
  var bNorm = convertToArray(b);
13912
- var results = aNorm.map(function(a) {
13764
+ result = aNorm.map(function(a) {
13913
13765
  return bNorm.map(function(b) {
13914
13766
  return _object_spread$7({}, a, b);
13915
13767
  });
13916
13768
  });
13917
- return results;
13918
13769
  } else if (a) {
13919
- return [
13770
+ result = [
13920
13771
  convertToArray(a)
13921
13772
  ];
13922
13773
  } else if (b) {
13923
- return [
13774
+ result = [
13924
13775
  convertToArray(b)
13925
13776
  ];
13926
13777
  } else {
13927
- return [
13778
+ result = [
13928
13779
  []
13929
13780
  ];
13930
13781
  }
13782
+ return result;
13931
13783
  }
13932
13784
 
13933
13785
  function _type_of$6(obj) {
@@ -13979,13 +13831,15 @@ function _type_of$6(obj) {
13979
13831
  * @param input - Date object or unix timestamp number to convert
13980
13832
  * @returns Unix timestamp number if input is valid, null/undefined if input is null/undefined
13981
13833
  */ function unixDateTimeSecondsNumberFromDateOrTimeNumber(input) {
13834
+ var result;
13982
13835
  if (input == null) {
13983
- return input;
13836
+ result = input;
13984
13837
  } else if (isDate(input)) {
13985
- return unixDateTimeSecondsNumberFromDate(input);
13838
+ result = unixDateTimeSecondsNumberFromDate(input);
13986
13839
  } else {
13987
- return input;
13840
+ result = input;
13988
13841
  }
13842
+ return result;
13989
13843
  }
13990
13844
  /**
13991
13845
  * Gets the current time as a unix timestamp number.
@@ -13998,13 +13852,15 @@ function unixDateTimeSecondsNumberFromDate(date) {
13998
13852
  return date != null ? Math.ceil(date.getTime() / 1000) : date;
13999
13853
  }
14000
13854
  function dateFromDateOrTimeSecondsNumber(input) {
13855
+ var result;
14001
13856
  if (input == null) {
14002
- return input;
13857
+ result = input;
14003
13858
  } else if (isDate(input)) {
14004
- return input;
13859
+ result = input;
14005
13860
  } else {
14006
- return unixDateTimeSecondsNumberToDate(input);
13861
+ result = unixDateTimeSecondsNumberToDate(input);
14007
13862
  }
13863
+ return result;
14008
13864
  }
14009
13865
  /**
14010
13866
  * Converts a unix timestamp number to a Date object.
@@ -14360,13 +14216,15 @@ function _unsupported_iterable_to_array$a(o, minLen) {
14360
14216
  * @param days - The number of days to offset (positive or negative)
14361
14217
  * @returns The resulting DayOfWeek
14362
14218
  */ function getDayOffset(day, days) {
14219
+ var result;
14363
14220
  if (days === 0) {
14364
- return day;
14221
+ result = day;
14365
14222
  } else if (days < 0) {
14366
- return getPreviousDay(day, days);
14223
+ result = getPreviousDay(day, days);
14367
14224
  } else {
14368
- return getNextDay(day, days);
14225
+ result = getNextDay(day, days);
14369
14226
  }
14227
+ return result;
14370
14228
  }
14371
14229
  /**
14372
14230
  * Returns the DayOfWeek that is the given number of days before the input day.
@@ -14777,11 +14635,7 @@ function waitForMs(ms, value) {
14777
14635
  }
14778
14636
 
14779
14637
  function mapPromiseOrValue(input, mapFn) {
14780
- if (isPromise(input)) {
14781
- return input.then(mapFn);
14782
- } else {
14783
- return mapFn(input);
14784
- }
14638
+ return isPromise(input) ? input.then(mapFn) : mapFn(input);
14785
14639
  }
14786
14640
 
14787
14641
  function _define_property$a(obj, key, value) {
@@ -15406,21 +15260,19 @@ function _performAsyncTask(_0, _1) {
15406
15260
  return doNextTry();
15407
15261
  }) : doNextTry()
15408
15262
  ];
15409
- } else {
15410
- // Error out.
15411
- if (throwError) {
15412
- throw result[0];
15413
- } else {
15414
- return [
15415
- 2,
15416
- [
15417
- value,
15418
- undefined,
15419
- false
15420
- ]
15421
- ];
15422
- }
15423
15263
  }
15264
+ // Error out.
15265
+ if (throwError) {
15266
+ throw result[0];
15267
+ }
15268
+ return [
15269
+ 2,
15270
+ [
15271
+ value,
15272
+ undefined,
15273
+ false
15274
+ ]
15275
+ ];
15424
15276
  }
15425
15277
  });
15426
15278
  })();
@@ -15482,11 +15334,7 @@ function _performAsyncTask(_0, _1) {
15482
15334
  if (maxParallelTasks && !nonConcurrentTaskKeyFactory) {
15483
15335
  result = function result(input) {
15484
15336
  // if there is no custom nonConcurrentTaskKeyFactory, then we can just run all tasks at once and skip the overhead of performTasksInParallel if the input has less than the maxParallelTasks
15485
- if (input.length <= maxParallelTasks) {
15486
- return performAllTasksInUnlimitedParallel(input);
15487
- } else {
15488
- return performTasksWithInput(input);
15489
- }
15337
+ return input.length <= maxParallelTasks ? performAllTasksInUnlimitedParallel(input) : performTasksWithInput(input);
15490
15338
  };
15491
15339
  } else {
15492
15340
  result = performTasksWithInput;
@@ -15519,25 +15367,20 @@ function _performAsyncTask(_0, _1) {
15519
15367
  return [
15520
15368
  2
15521
15369
  ];
15370
+ }
15371
+ promiseRef = promiseReference();
15372
+ if (isFulfillingTask) {
15373
+ requestTasksQueue.push([
15374
+ parallelIndex,
15375
+ promiseRef
15376
+ ]);
15522
15377
  } else {
15523
- promiseRef = promiseReference();
15524
- if (isFulfillingTask) {
15525
- requestTasksQueue.push([
15526
- parallelIndex,
15527
- promiseRef
15528
- ]);
15529
- return [
15530
- 2,
15531
- promiseRef.promise
15532
- ];
15533
- } else {
15534
- void fulfillRequestMoreTasks(parallelIndex, promiseRef);
15535
- }
15536
- return [
15537
- 2,
15538
- promiseRef.promise
15539
- ];
15378
+ void fulfillRequestMoreTasks(parallelIndex, promiseRef);
15540
15379
  }
15380
+ return [
15381
+ 2,
15382
+ promiseRef.promise
15383
+ ];
15541
15384
  });
15542
15385
  })();
15543
15386
  };
@@ -15872,11 +15715,7 @@ function _object_spread$4(target) {
15872
15715
  currentCount = count + increasedExecutions;
15873
15716
  timeOfLastExecution = new Date();
15874
15717
  }
15875
- if (effectiveCount >= countForMaxWaitTime) {
15876
- return config.maxWaitTime;
15877
- } else {
15878
- return (Math.pow(config.exponentRate, Math.max(effectiveCount, 0)) - 1) * MS_IN_SECOND;
15879
- }
15718
+ return effectiveCount >= countForMaxWaitTime ? config.maxWaitTime : (Math.pow(config.exponentRate, Math.max(effectiveCount, 0)) - 1) * MS_IN_SECOND;
15880
15719
  }
15881
15720
  function getNextWaitTime(increase) {
15882
15721
  return _nextWaitTime(increase !== null && increase !== void 0 ? increase : 0);
@@ -16823,11 +16662,7 @@ function _is_native_reflect_construct$2() {
16823
16662
  * @returns a Date representing the estimated end time, or null if no duration remains
16824
16663
  */ function approximateTimerEndDate(timer) {
16825
16664
  var durationRemaining = timer.durationRemaining;
16826
- if (durationRemaining != null) {
16827
- return new Date(Date.now() + durationRemaining);
16828
- } else {
16829
- return null;
16830
- }
16665
+ return durationRemaining != null ? new Date(Date.now() + durationRemaining) : null;
16831
16666
  }
16832
16667
 
16833
16668
  /**
@@ -17095,6 +16930,10 @@ function _unsupported_iterable_to_array$7(o, minLen) {
17095
16930
  // check self
17096
16931
  if (a === b) {
17097
16932
  result = true;
16933
+ } else if (isDate(a) || isDate(b)) {
16934
+ // Check Date before applying the pojoFilter — the spread copy in
16935
+ // filterFromPOJOFunction destroys Date instances (producing {}).
16936
+ result = isDate(a) && isDate(b) && isEqualDate(a, b);
17098
16937
  } else {
17099
16938
  // run pojo filter before comparison
17100
16939
  a = pojoFilter(a, true);
@@ -17844,11 +17683,7 @@ function _object_spread$2(target) {
17844
17683
  * @param config - The host and port configuration, or null/undefined
17845
17684
  * @returns The joined string, or null/undefined if config is null/undefined
17846
17685
  */ function joinHostAndPort(config) {
17847
- if (config) {
17848
- return "".concat(config.host, ":").concat(config.port);
17849
- } else {
17850
- return config;
17851
- }
17686
+ return config ? "".concat(config.host, ":").concat(config.port) : config;
17852
17687
  }
17853
17688
 
17854
17689
  function _array_like_to_array$4(arr, len) {
@@ -17962,9 +17797,8 @@ function _unsupported_iterable_to_array$4(o, minLen) {
17962
17797
  var _separateValues1 = separateValues(mods, mask), modModify = _separateValues1.included;
17963
17798
  var modifiedResults = this._modifyCollectionWithoutMask(currentModify, change, modModify, config);
17964
17799
  return this._mergeMaskResults(current, currentRetain, modifiedResults, readKey);
17965
- } else {
17966
- return this._modifyCollectionWithoutMask(current, change, mods, config);
17967
17800
  }
17801
+ return this._modifyCollectionWithoutMask(current, change, mods, config);
17968
17802
  }
17969
17803
  },
17970
17804
  {
@@ -18088,11 +17922,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
18088
17922
  * @returns the modified collection with all changes applied
18089
17923
  */ // eslint-disable-next-line @typescript-eslint/max-params
18090
17924
  function _modifyCollection(current, mods, modifyCollection, readType) {
18091
- if (readType) {
18092
- return ModelRelationUtility._modifyMultiTypeCollection(current, mods, readType, modifyCollection);
18093
- } else {
18094
- return modifyCollection(current, mods);
18095
- }
17925
+ return readType ? ModelRelationUtility._modifyMultiTypeCollection(current, mods, readType, modifyCollection) : modifyCollection(current, mods);
18096
17926
  }
18097
17927
  },
18098
17928
  {
@@ -18108,11 +17938,7 @@ function _unsupported_iterable_to_array$4(o, minLen) {
18108
17938
  var values = (_inputMap_get = inputMap.get(type)) !== null && _inputMap_get !== void 0 ? _inputMap_get : [];
18109
17939
  var _$mods = (_modsMap_get = modsMap.get(type)) !== null && _modsMap_get !== void 0 ? _modsMap_get : [];
18110
17940
  // Only modify if they've got changes for their type.
18111
- if (_$mods.length === 0) {
18112
- return values; // No mods, no change to those types.
18113
- } else {
18114
- return modifyCollection(values, _$mods);
18115
- }
17941
+ return _$mods.length === 0 ? values : modifyCollection(values, _$mods);
18116
17942
  });
18117
17943
  // Rejoin all changes.
18118
17944
  return modifiedSubcollections.reduce(function(x, y) {
@@ -18187,28 +18013,26 @@ function _unsupported_iterable_to_array$4(o, minLen) {
18187
18013
  * @returns The collection with matching items removed.
18188
18014
  */ // eslint-disable-next-line @typescript-eslint/max-params
18189
18015
  function removeFromCollection(current, remove, readKey, shouldRemove) {
18190
- if (current === null || current === void 0 ? void 0 : current.length) {
18191
- if (shouldRemove) {
18192
- var currentKeyPairs = makeKeyPairs(current, readKey);
18193
- var map = new Map(currentKeyPairs);
18194
- remove.forEach(function(x) {
18195
- var key = readKey(x);
18196
- var removalTarget = map.get(key);
18197
- if (removalTarget && shouldRemove(removalTarget)) {
18198
- map.delete(key); // Remove from the map.
18199
- }
18200
- });
18201
- return currentKeyPairs.filter(function(x) {
18202
- return map.has(x[0]);
18203
- }).map(function(x) {
18204
- return x[1];
18205
- }); // Retain order, remove from map.
18206
- } else {
18207
- return ModelRelationUtility.removeKeysFromCollection(current, remove.map(readKey), readKey);
18208
- }
18209
- } else {
18016
+ if (!(current === null || current === void 0 ? void 0 : current.length)) {
18210
18017
  return [];
18211
18018
  }
18019
+ if (shouldRemove) {
18020
+ var currentKeyPairs = makeKeyPairs(current, readKey);
18021
+ var map = new Map(currentKeyPairs);
18022
+ remove.forEach(function(x) {
18023
+ var key = readKey(x);
18024
+ var removalTarget = map.get(key);
18025
+ if (removalTarget && shouldRemove(removalTarget)) {
18026
+ map.delete(key); // Remove from the map.
18027
+ }
18028
+ });
18029
+ return currentKeyPairs.filter(function(x) {
18030
+ return map.has(x[0]);
18031
+ }).map(function(x) {
18032
+ return x[1];
18033
+ }); // Retain order, remove from map.
18034
+ }
18035
+ return ModelRelationUtility.removeKeysFromCollection(current, remove.map(readKey), readKey);
18212
18036
  }
18213
18037
  },
18214
18038
  {
@@ -19423,11 +19247,7 @@ function _unsupported_iterable_to_array(o, minLen) {
19423
19247
  var separator = config.separator, mergeMeta = config.mergeMeta;
19424
19248
  var value = inputValue.value, leafMeta = inputValue.leafMeta, nodeMeta = inputValue.nodeMeta;
19425
19249
  function nextMeta(node, nextMeta) {
19426
- if (mergeMeta && node.meta != null) {
19427
- return mergeMeta(node.meta, nextMeta);
19428
- } else {
19429
- return nextMeta;
19430
- }
19250
+ return mergeMeta && node.meta != null ? mergeMeta(node.meta, nextMeta) : nextMeta;
19431
19251
  }
19432
19252
  var parts = value.split(separator);
19433
19253
  var currentNode = tree;
@@ -19955,13 +19775,9 @@ function invertMaybeBoolean(x) {
19955
19775
  var rFn = function rFn(array) {
19956
19776
  return Boolean(array.reduce(reduceFn));
19957
19777
  };
19958
- if (emptyArrayValue != null) {
19959
- return function(array) {
19960
- return array.length ? rFn(array) : emptyArrayValue;
19961
- };
19962
- } else {
19963
- return rFn;
19964
- }
19778
+ return emptyArrayValue != null ? function(array) {
19779
+ return array.length ? rFn(array) : emptyArrayValue;
19780
+ } : rFn;
19965
19781
  }
19966
19782
  /**
19967
19783
  * Creates a new BooleanFactory that generates random boolean values based on chance.