@aeriajs/common 0.0.78 → 0.0.80
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/dist/result.d.ts +1 -0
- package/dist/result.js +8 -2
- package/dist/result.mjs +4 -1
- package/package.json +1 -1
- package/dist/isError.d.ts +0 -2
- package/dist/isError.js +0 -9
- package/dist/isError.mjs +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export * from './getReferenceProperty.js';
|
|
|
15
15
|
export * from './getValueFromPath.js';
|
|
16
16
|
export * from './http.js';
|
|
17
17
|
export * from './isEmptyObject.js';
|
|
18
|
-
export * from './isError.js';
|
|
19
18
|
export * from './isGranted.js';
|
|
20
19
|
export * from './isObjectId.js';
|
|
21
20
|
export * from './isReference.js';
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,6 @@ __exportStar(require("./getReferenceProperty.js"), exports);
|
|
|
31
31
|
__exportStar(require("./getValueFromPath.js"), exports);
|
|
32
32
|
__exportStar(require("./http.js"), exports);
|
|
33
33
|
__exportStar(require("./isEmptyObject.js"), exports);
|
|
34
|
-
__exportStar(require("./isError.js"), exports);
|
|
35
34
|
__exportStar(require("./isGranted.js"), exports);
|
|
36
35
|
__exportStar(require("./isObjectId.js"), exports);
|
|
37
36
|
__exportStar(require("./isReference.js"), exports);
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,6 @@ export * from "./getReferenceProperty.mjs";
|
|
|
16
16
|
export * from "./getValueFromPath.mjs";
|
|
17
17
|
export * from "./http.mjs";
|
|
18
18
|
export * from "./isEmptyObject.mjs";
|
|
19
|
-
export * from "./isError.mjs";
|
|
20
19
|
export * from "./isGranted.mjs";
|
|
21
20
|
export * from "./isObjectId.mjs";
|
|
22
21
|
export * from "./isReference.mjs";
|
package/dist/result.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Result } from '@aeriajs/types';
|
|
2
2
|
export declare const isResult: (value: any) => value is Result.Either<unknown, unknown>;
|
|
3
|
+
export declare const isError: (object: any) => object is Result.Error<unknown>;
|
|
3
4
|
export declare const throwIfError: <TValue>(either: Result.Either<unknown, TValue>, message?: any) => NonNullable<TValue>;
|
package/dist/result.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.throwIfError = exports.isResult = void 0;
|
|
3
|
+
exports.throwIfError = exports.isError = exports.isResult = void 0;
|
|
4
4
|
const isResult = (value) => {
|
|
5
5
|
return value
|
|
6
6
|
&& value.constructor === Object
|
|
7
7
|
&& (value._tag === 'Error' || value._tag === 'Result');
|
|
8
8
|
};
|
|
9
9
|
exports.isResult = isResult;
|
|
10
|
+
const isError = (object) => {
|
|
11
|
+
return object
|
|
12
|
+
&& object._tag === 'Error'
|
|
13
|
+
&& 'error' in object;
|
|
14
|
+
};
|
|
15
|
+
exports.isError = isError;
|
|
10
16
|
const throwIfError = (either, message) => {
|
|
11
|
-
if (
|
|
17
|
+
if (either.error) {
|
|
12
18
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
19
|
console.trace(JSON.stringify(either.error, null, 2));
|
|
14
20
|
}
|
package/dist/result.mjs
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
export const isResult = (value) => {
|
|
3
3
|
return value && value.constructor === Object && (value._tag === "Error" || value._tag === "Result");
|
|
4
4
|
};
|
|
5
|
+
export const isError = (object) => {
|
|
6
|
+
return object && object._tag === "Error" && "error" in object;
|
|
7
|
+
};
|
|
5
8
|
export const throwIfError = (either, message) => {
|
|
6
|
-
if (
|
|
9
|
+
if (either.error) {
|
|
7
10
|
if (true) {
|
|
8
11
|
console.trace(JSON.stringify(either.error, null, 2));
|
|
9
12
|
}
|
package/package.json
CHANGED
package/dist/isError.d.ts
DELETED
package/dist/isError.js
DELETED
package/dist/isError.mjs
DELETED