@zelgadis87/utils-core 5.2.1 → 5.2.2

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/esbuild/index.mjs CHANGED
@@ -416,8 +416,12 @@ function indexBySymbolWith(arr, getter) {
416
416
  function doIndexByWith(arr, getter) {
417
417
  return arr.reduce((dict, cur) => {
418
418
  const key = getter(cur);
419
- if (key !== null && key !== void 0)
419
+ if (key !== null && key !== void 0) {
420
+ if (dict[key]) {
421
+ throw new Error(`Multiple values indexed by same key "${String(key)}".`);
422
+ }
420
423
  dict[key] = cur;
424
+ }
421
425
  return dict;
422
426
  }, {});
423
427
  }
@@ -788,6 +792,11 @@ function getCauseStackFromError(error) {
788
792
  return `
789
793
  caused by: ${getStackFromError(asError(error.cause))}`;
790
794
  }
795
+ var NonExhaustiveSwitchError = class extends Error {
796
+ constructor(value) {
797
+ super("Expected switch to be exhaustive, got: " + value);
798
+ }
799
+ };
791
800
 
792
801
  // src/utils/json.ts
793
802
  function tryToParseJson(jsonContent) {
@@ -2766,6 +2775,7 @@ export {
2766
2775
  LazyDictionary,
2767
2776
  Logger,
2768
2777
  NEVER,
2778
+ NonExhaustiveSwitchError,
2769
2779
  Optional,
2770
2780
  PredicateBuilder,
2771
2781
  RandomTimeDuration,