exupery-core-internals 0.1.10 → 0.1.12

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
@@ -8,4 +8,4 @@ export * from "./imp/public/switch_state";
8
8
  export * from "./imp/public/get_location_info";
9
9
  export * from "./imp/public/set";
10
10
  export * from "./imp/public/not_set";
11
- export * from "./unguaranteed_transaction_result";
11
+ export * from "./transformation";
package/dist/index.js CHANGED
@@ -24,4 +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);
27
+ __exportStar(require("./transformation"), exports);
@@ -0,0 +1,18 @@
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(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
+ }
@@ -5,7 +5,7 @@ var transformation;
5
5
  (function (transformation) {
6
6
  transformation.failed = (exception) => {
7
7
  return {
8
- 'process result': (success, exception_handler) => {
8
+ process: (success, exception_handler) => {
9
9
  exception_handler(exception);
10
10
  },
11
11
  'transform': (success, exception_handler) => {
@@ -13,12 +13,15 @@ var transformation;
13
13
  },
14
14
  'map': (handle_value, handle_exception) => {
15
15
  return transformation.failed(handle_exception(exception));
16
+ },
17
+ 'map_result': (handle_value) => {
18
+ return transformation.failed(exception);
16
19
  }
17
20
  };
18
21
  };
19
22
  transformation.successful = (value) => {
20
23
  return {
21
- 'process result': (success, exception_handler) => {
24
+ process: (success, exception_handler) => {
22
25
  success(value);
23
26
  },
24
27
  'transform': (success, exception_handler) => {
@@ -26,6 +29,9 @@ var transformation;
26
29
  },
27
30
  'map': (handle_value, handle_exception) => {
28
31
  return transformation.successful(handle_value(value));
32
+ },
33
+ 'map_result': (handle_value) => {
34
+ return transformation.successful(handle_value(value));
29
35
  }
30
36
  };
31
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-internals",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "license": "ISC",
5
5
  "description": "",
6
6
  "author": "Corno",
@@ -1,13 +0,0 @@
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
- }