@augment-vir/common 12.8.0 → 12.9.0

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,6 +1,6 @@
1
1
  export declare function parseJson<ParsedJsonGeneric>({ jsonString, errorHandler, shapeMatcher, }: {
2
2
  jsonString: string;
3
- errorHandler?: (error: unknown) => void;
3
+ errorHandler?: (error: unknown) => never | ParsedJsonGeneric;
4
4
  shapeMatcher?: ParsedJsonGeneric;
5
5
  }): ParsedJsonGeneric;
6
6
  //# sourceMappingURL=json.d.ts.map
@@ -17,9 +17,12 @@ function parseJson({ jsonString, errorHandler, shapeMatcher, }) {
17
17
  return parsedJson;
18
18
  }
19
19
  catch (error) {
20
- errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error);
21
- // if the above error handler doesn't halt execution then this will
22
- throw error;
20
+ if (errorHandler) {
21
+ return errorHandler(error);
22
+ }
23
+ else {
24
+ throw error;
25
+ }
23
26
  }
24
27
  }
25
28
  exports.parseJson = parseJson;
@@ -1,6 +1,6 @@
1
1
  export declare function parseJson<ParsedJsonGeneric>({ jsonString, errorHandler, shapeMatcher, }: {
2
2
  jsonString: string;
3
- errorHandler?: (error: unknown) => void;
3
+ errorHandler?: (error: unknown) => never | ParsedJsonGeneric;
4
4
  shapeMatcher?: ParsedJsonGeneric;
5
5
  }): ParsedJsonGeneric;
6
6
  //# sourceMappingURL=json.d.ts.map
@@ -14,8 +14,11 @@ export function parseJson({ jsonString, errorHandler, shapeMatcher, }) {
14
14
  return parsedJson;
15
15
  }
16
16
  catch (error) {
17
- errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler(error);
18
- // if the above error handler doesn't halt execution then this will
19
- throw error;
17
+ if (errorHandler) {
18
+ return errorHandler(error);
19
+ }
20
+ else {
21
+ throw error;
22
+ }
20
23
  }
21
24
  }
@@ -1,6 +1,6 @@
1
1
  export declare function parseJson<ParsedJsonGeneric>({ jsonString, errorHandler, shapeMatcher, }: {
2
2
  jsonString: string;
3
- errorHandler?: (error: unknown) => void;
3
+ errorHandler?: (error: unknown) => never | ParsedJsonGeneric;
4
4
  shapeMatcher?: ParsedJsonGeneric;
5
5
  }): ParsedJsonGeneric;
6
6
  //# sourceMappingURL=json.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "12.8.0",
3
+ "version": "12.9.0",
4
4
  "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",
5
5
  "bugs": {
6
6
  "url": "https://github.com/electrovir/augment-vir/issues"