@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,19 @@
1
+ import { assertNever } from "../assertNever";
2
+ describe(assertNever, () => {
3
+ it("throws an error on unhandled types", () => {
4
+ function getInvalidType() {
5
+ return 0;
6
+ }
7
+ expect(() => {
8
+ const invalidType = getInvalidType();
9
+ switch (invalidType) {
10
+ case 1:
11
+ case 2:
12
+ return;
13
+ default:
14
+ assertNever(invalidType);
15
+ }
16
+ }).toThrow();
17
+ });
18
+ });
19
+ //# 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,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,QAAQ,CAAC,WAAW,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,WAAW,CAAC,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"}
@@ -1,3 +1,4 @@
1
1
  export * from "./assertNever";
2
2
  export * from "./logNever";
3
+ export * from "./promiseAllValues";
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
@@ -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,9 @@
1
+ import { fromPairs } from "lodash-es";
2
+ export async function promiseAllValues(promiseObject) {
3
+ const results = await Promise.all(Object.entries(promiseObject).map(async ([key, promise]) => [
4
+ key,
5
+ await promise,
6
+ ]));
7
+ return fromPairs(results);
8
+ }
9
+ //# sourceMappingURL=promiseAllValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promiseAllValues.js","sourceRoot":"","sources":["../../../src/utils/promiseAllValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAMtC,MAAM,CAAC,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,SAAS,CAAC,OAAO,CAAM,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@percepta/utils",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
5
8
  "description": "Shared utils for Mosaic",
6
9
  "main": "dist/cjs/index.js",
7
10
  "module": "dist/esnext/index.js",
@@ -15,13 +18,14 @@
15
18
  "devDependencies": {
16
19
  "@types/lodash-es": "^4.17.12",
17
20
  "@types/node": "^22.10.7",
18
- "jest": "^29.7.0",
19
21
  "@mosaic/build": "0.0.2"
20
22
  },
21
23
  "scripts": {
22
24
  "build": "build-ts --high-compat",
25
+ "dev": "pnpm build --watch",
23
26
  "clean": "rimraf dist",
24
27
  "lint": "eslint .",
28
+ "lint:fix": "eslint . --fix",
25
29
  "test": "jest"
26
30
  }
27
31
  }