exupery-core-internals 0.1.13 → 0.1.14
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 +1 -0
- package/dist/index.js +1 -0
- package/dist/refinement.d.ts +16 -0
- package/dist/refinement.js +38 -0
- package/dist/transformation.d.ts +2 -18
- package/dist/transformation.js +0 -36
- package/package.json +1 -1
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/set"), exports);
|
|
25
25
|
__exportStar(require("./imp/public/not_set"), exports);
|
|
26
26
|
__exportStar(require("./transformation"), exports);
|
|
27
|
+
__exportStar(require("./refinement"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Refinement_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(success: ($: T) => void, exception: ($: E) => void): void;
|
|
7
|
+
map<NT, NE>(handle_value: ($: T) => NT, handle_exception: ($: E) => NE): Refinement_Result<NT, NE>;
|
|
8
|
+
map_result<NT>(handle_value: ($: T) => NT): Refinement_Result<NT, E>;
|
|
9
|
+
transform<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): NT;
|
|
10
|
+
}
|
|
11
|
+
export type Refinement_With_Parameters<In, Parameters, Out, Error> = ($: In, $p: Parameters) => Refinement_Result<Out, Error>;
|
|
12
|
+
export type Refinement_Without_Parameters<In, Out, Error> = ($: In) => Refinement_Result<Out, Error>;
|
|
13
|
+
export declare namespace refinement {
|
|
14
|
+
const failed: <T, E>(exception: E) => Refinement_Result<T, E>;
|
|
15
|
+
const successful: <T, E>(value: T) => Refinement_Result<T, E>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refinement = void 0;
|
|
4
|
+
var refinement;
|
|
5
|
+
(function (refinement) {
|
|
6
|
+
refinement.failed = (exception) => {
|
|
7
|
+
return {
|
|
8
|
+
'process': (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 refinement.failed(handle_exception(exception));
|
|
16
|
+
},
|
|
17
|
+
'map_result': (handle_value) => {
|
|
18
|
+
return refinement.failed(exception);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
refinement.successful = (value) => {
|
|
23
|
+
return {
|
|
24
|
+
'process': (success, exception_handler) => {
|
|
25
|
+
success(value);
|
|
26
|
+
},
|
|
27
|
+
'transform': (success, exception_handler) => {
|
|
28
|
+
return success(value);
|
|
29
|
+
},
|
|
30
|
+
'map': (handle_value, handle_exception) => {
|
|
31
|
+
return refinement.successful(handle_value(value));
|
|
32
|
+
},
|
|
33
|
+
'map_result': (handle_value) => {
|
|
34
|
+
return refinement.successful(handle_value(value));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
})(refinement || (exports.refinement = refinement = {}));
|
package/dist/transformation.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
export
|
|
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(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
|
-
map_result<NT>(handle_value: ($: T) => NT): Unguaranteed_Transformation_Result<NT, E>;
|
|
9
|
-
transform<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): NT;
|
|
10
|
-
}
|
|
11
|
-
export type Guaranteed_Transformation_With_Parameters<In, Parameters, Out> = ($: In, $p: Parameters) => Out;
|
|
12
|
-
export type Guaranteed_Transformation_Without_Parameters<In, Out> = ($: In) => Out;
|
|
13
|
-
export type Unguaranteed_Transformation_With_Parameters<In, Parameters, Out, Error> = ($: In, $p: Parameters) => Unguaranteed_Transformation_Result<Out, Error>;
|
|
14
|
-
export type Unguaranteed_Transformation_Without_Parameters<In, Out, Error> = ($: In) => Unguaranteed_Transformation_Result<Out, Error>;
|
|
15
|
-
export declare namespace transformation {
|
|
16
|
-
const failed: <T, E>(exception: E) => Unguaranteed_Transformation_Result<T, E>;
|
|
17
|
-
const successful: <T, E>(value: T) => Unguaranteed_Transformation_Result<T, E>;
|
|
18
|
-
}
|
|
1
|
+
export type Transformation_With_Parameters<In, Parameters, Out> = ($: In, $p: Parameters) => Out;
|
|
2
|
+
export type Transformation_Without_Parameters<In, Out> = ($: In) => Out;
|
package/dist/transformation.js
CHANGED
|
@@ -1,38 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
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: (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
|
-
'map_result': (handle_value) => {
|
|
18
|
-
return transformation.failed(exception);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
transformation.successful = (value) => {
|
|
23
|
-
return {
|
|
24
|
-
process: (success, exception_handler) => {
|
|
25
|
-
success(value);
|
|
26
|
-
},
|
|
27
|
-
'transform': (success, exception_handler) => {
|
|
28
|
-
return success(value);
|
|
29
|
-
},
|
|
30
|
-
'map': (handle_value, handle_exception) => {
|
|
31
|
-
return transformation.successful(handle_value(value));
|
|
32
|
-
},
|
|
33
|
-
'map_result': (handle_value) => {
|
|
34
|
-
return transformation.successful(handle_value(value));
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
})(transformation || (exports.transformation = transformation = {}));
|