@aeriajs/common 0.0.66 → 0.0.68

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/result.d.ts CHANGED
@@ -14,4 +14,5 @@ export declare namespace Result {
14
14
  readonly result: TValue;
15
15
  };
16
16
  }
17
+ export declare const isResult: (value: any) => value is Result.Either<unknown, unknown>;
17
18
  export declare const throwIfError: <TValue>(either: R.Either<unknown, TValue>, message?: any) => NonNullable<TValue>;
package/dist/result.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.throwIfError = exports.Result = void 0;
3
+ exports.throwIfError = exports.isResult = exports.Result = void 0;
4
4
  var Result;
5
5
  (function (Result) {
6
6
  Result.error = (value) => ({
@@ -14,6 +14,12 @@ var Result;
14
14
  result: value,
15
15
  });
16
16
  })(Result || (exports.Result = Result = {}));
17
+ const isResult = (value) => {
18
+ return value
19
+ && value.constructor === Object
20
+ && (value._tag === 'Error' || value._tag === 'Result');
21
+ };
22
+ exports.isResult = isResult;
17
23
  const throwIfError = (either, message) => {
18
24
  if (!either.result) {
19
25
  if (process.env.NODE_ENV !== 'production') {
package/dist/result.mjs CHANGED
@@ -12,6 +12,9 @@ export var Result;
12
12
  result: value
13
13
  });
14
14
  })(Result || (Result = {}));
15
+ export const isResult = (value) => {
16
+ return value && value.constructor === Object && (value._tag === "Error" || value._tag === "Result");
17
+ };
15
18
  export const throwIfError = (either, message) => {
16
19
  if (!either.result) {
17
20
  if (true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/common",
3
- "version": "0.0.66",
3
+ "version": "0.0.68",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -31,7 +31,7 @@
31
31
  "bson": "^6.5.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@aeriajs/types": "^0.0.59",
34
+ "@aeriajs/types": "^0.0.60",
35
35
  "bson": "^6.5.0"
36
36
  },
37
37
  "scripts": {