@percepta/utils 0.1.2 → 0.1.4

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=assertNever.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertNever.test.d.ts","sourceRoot":"","sources":["../../../../src/utils/__tests__/assertNever.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const assertNever_1 = require("../assertNever");
4
+ describe(assertNever_1.assertNever, () => {
5
+ it("throws an error on unhandled types", () => {
6
+ function getInvalidType() {
7
+ return 0;
8
+ }
9
+ expect(() => {
10
+ const invalidType = getInvalidType();
11
+ switch (invalidType) {
12
+ case 1:
13
+ case 2:
14
+ return;
15
+ default:
16
+ (0, assertNever_1.assertNever)(invalidType);
17
+ }
18
+ }).toThrow();
19
+ });
20
+ });
21
+ //# sourceMappingURL=assertNever.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertNever.test.js","sourceRoot":"","sources":["../../../../src/utils/__tests__/assertNever.test.ts"],"names":[],"mappings":";;AAAA,gDAA6C;AAE7C,QAAQ,CAAC,yBAAW,EAAE,GAAG,EAAE;IACzB,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAG5C,SAAS,cAAc;YACrB,OAAO,CAAU,CAAC;QACpB,CAAC;QAED,MAAM,CAAC,GAAG,EAAE;YACV,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;YACrC,QAAQ,WAAW,EAAE,CAAC;gBACpB,KAAK,CAAC,CAAC;gBACP,KAAK,CAAC;oBACJ,OAAO;gBACT;oBACE,IAAA,yBAAW,EAAC,WAAW,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from "./assertNever";
2
2
  export * from "./logNever";
3
+ export * from "./promiseAllValues";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./assertNever"), exports);
18
18
  __exportStar(require("./logNever"), exports);
19
+ __exportStar(require("./promiseAllValues"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6CAA2B;AAC3B,qDAAmC"}
@@ -0,0 +1,6 @@
1
+ type PromiseObject<T> = {
2
+ [K in keyof T]: Promise<T[K]>;
3
+ };
4
+ export declare function promiseAllValues<T>(promiseObject: PromiseObject<T>): Promise<T>;
5
+ export {};
6
+ //# sourceMappingURL=promiseAllValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promiseAllValues.d.ts","sourceRoot":"","sources":["../../../src/utils/promiseAllValues.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,CAAC,CAAC,IAAI;KACrB,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,GAC9B,OAAO,CAAC,CAAC,CAAC,CAWZ"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.promiseAllValues = promiseAllValues;
4
+ const lodash_es_1 = require("lodash-es");
5
+ async function promiseAllValues(promiseObject) {
6
+ const results = await Promise.all(Object.entries(promiseObject).map(async ([key, promise]) => [
7
+ key,
8
+ await promise,
9
+ ]));
10
+ return (0, lodash_es_1.fromPairs)(results);
11
+ }
12
+ //# sourceMappingURL=promiseAllValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promiseAllValues.js","sourceRoot":"","sources":["../../../src/utils/promiseAllValues.ts"],"names":[],"mappings":";;AAMA,4CAaC;AAnBD,yCAAsC;AAM/B,KAAK,UAAU,gBAAgB,CACpC,aAA+B;IAE/B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,CAC/B,KAAK,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,EAA8B,EAAE,CAAC;QACpD,GAAG;QACH,MAAM,OAAO;KACd,CACF,CACF,CAAC;IAEF,OAAO,IAAA,qBAAS,EAAC,OAAO,CAAM,CAAC;AACjC,CAAC"}