exupery-core-internals 0.1.8 → 0.1.10
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
CHANGED
package/dist/index.js
CHANGED
|
@@ -24,3 +24,4 @@ __exportStar(require("./imp/public/switch_state"), exports);
|
|
|
24
24
|
__exportStar(require("./imp/public/get_location_info"), exports);
|
|
25
25
|
__exportStar(require("./imp/public/set"), exports);
|
|
26
26
|
__exportStar(require("./imp/public/not_set"), exports);
|
|
27
|
+
__exportStar(require("./unguaranteed_transaction_result"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Unguaranteed_Transformation_Result<T, E> {
|
|
2
|
+
/**
|
|
3
|
+
* @param set what to do when the value was set, returns the new type
|
|
4
|
+
* @param not_set what to do when the value was not set, returns the new type
|
|
5
|
+
*/
|
|
6
|
+
'process result'(success: ($: T) => void, exception: ($: E) => void): void;
|
|
7
|
+
map<NT, NE>(handle_value: ($: T) => NT, handle_exception: ($: E) => NE): Unguaranteed_Transformation_Result<NT, NE>;
|
|
8
|
+
transform<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): NT;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace transformation {
|
|
11
|
+
const failed: <T, E>(exception: E) => Unguaranteed_Transformation_Result<T, E>;
|
|
12
|
+
const successful: <T, E>(value: T) => Unguaranteed_Transformation_Result<T, E>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformation = void 0;
|
|
4
|
+
var transformation;
|
|
5
|
+
(function (transformation) {
|
|
6
|
+
transformation.failed = (exception) => {
|
|
7
|
+
return {
|
|
8
|
+
'process result': (success, exception_handler) => {
|
|
9
|
+
exception_handler(exception);
|
|
10
|
+
},
|
|
11
|
+
'transform': (success, exception_handler) => {
|
|
12
|
+
return exception_handler(exception);
|
|
13
|
+
},
|
|
14
|
+
'map': (handle_value, handle_exception) => {
|
|
15
|
+
return transformation.failed(handle_exception(exception));
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
transformation.successful = (value) => {
|
|
20
|
+
return {
|
|
21
|
+
'process result': (success, exception_handler) => {
|
|
22
|
+
success(value);
|
|
23
|
+
},
|
|
24
|
+
'transform': (success, exception_handler) => {
|
|
25
|
+
return success(value);
|
|
26
|
+
},
|
|
27
|
+
'map': (handle_value, handle_exception) => {
|
|
28
|
+
return transformation.successful(handle_value(value));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
})(transformation || (exports.transformation = transformation = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exupery-core-internals",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "Corno",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"url": "https://github.com/corno/exupery-core/issues"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"exupery-core-types": "^0.1.
|
|
18
|
+
"exupery-core-types": "^0.1.6"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/node": "^18.15.3"
|