@punks/backend-core 0.0.25 → 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.
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/index.d.ts +1 -0
- package/dist/cjs/types/utils/mappings.d.ts +4 -0
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/index.d.ts +1 -0
- package/dist/esm/types/utils/mappings.d.ts +4 -0
- package/dist/index.d.ts +6 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -332,6 +332,14 @@ function sleep(ms) {
|
|
|
332
332
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
const mapOrThrow = ({ mapper, throw: throwFn, }) => {
|
|
336
|
+
const output = mapper();
|
|
337
|
+
if (!output) {
|
|
338
|
+
return throwFn();
|
|
339
|
+
}
|
|
340
|
+
return output;
|
|
341
|
+
};
|
|
342
|
+
|
|
335
343
|
const newUuid = () => {
|
|
336
344
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
337
345
|
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
@@ -28379,6 +28387,7 @@ exports.iterate = iterate;
|
|
|
28379
28387
|
exports.joinPath = joinPath;
|
|
28380
28388
|
exports.jsonDistinct = jsonDistinct;
|
|
28381
28389
|
exports.last = last;
|
|
28390
|
+
exports.mapOrThrow = mapOrThrow;
|
|
28382
28391
|
exports.newUuid = newUuid;
|
|
28383
28392
|
exports.notNull = notNull;
|
|
28384
28393
|
exports.notUndefined = notUndefined;
|