@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/CHANGELOG.md +231 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/_index.d.ts +2 -1
- package/dist/utils/errors/withTryCatch.d.ts +3 -2
- package/dist/utils/errors.d.ts +13 -0
- package/dist/utils/numbers.d.ts +1 -1
- package/dist/utils/operations.d.ts +18 -0
- package/dist/utils/records.d.ts +21 -0
- package/esbuild/index.cjs +12 -1
- package/esbuild/index.cjs.map +2 -2
- package/esbuild/index.mjs +11 -1
- package/esbuild/index.mjs.map +2 -2
- package/package.json +8 -9
- package/src/utils/_index.ts +2 -1
- package/src/utils/arrays/indexBy.ts +5 -1
- package/src/utils/errors/withTryCatch.ts +3 -3
- package/src/utils/errors.ts +17 -0
- package/src/utils/operations.ts +24 -0
- package/src/utils/records.ts +20 -0
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,
|