@punks/backend-core 0.0.26 → 0.0.27
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const mapOrThrow: <
|
|
2
|
-
mapper: (
|
|
3
|
-
throw: (
|
|
4
|
-
}) =>
|
|
1
|
+
export declare const mapOrThrow: <T>({ mapper, throw: throwFn, }: {
|
|
2
|
+
mapper: () => T | undefined;
|
|
3
|
+
throw: () => void;
|
|
4
|
+
}) => T;
|
package/dist/esm/index.js
CHANGED
|
@@ -323,10 +323,10 @@ function sleep(ms) {
|
|
|
323
323
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
const mapOrThrow = (
|
|
327
|
-
const output = mapper(
|
|
326
|
+
const mapOrThrow = ({ mapper, throw: throwFn, }) => {
|
|
327
|
+
const output = mapper();
|
|
328
328
|
if (!output) {
|
|
329
|
-
return throwFn(
|
|
329
|
+
return throwFn();
|
|
330
330
|
}
|
|
331
331
|
return output;
|
|
332
332
|
};
|