exupery-core-types 0.1.2 → 0.1.4

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/Array.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Async_Value } from "./Async_Value";
2
+ import { Unsafe_Async_Value } from "./Unsafe_Async_Value";
2
3
  import { Optional_Value } from "./Optional_Value";
3
4
  /**
4
5
  * A Exupery array.
@@ -7,21 +8,22 @@ import { Optional_Value } from "./Optional_Value";
7
8
  export interface Array<T> {
8
9
  /**
9
10
  *
10
- * @param $v callback to transform an individual entry.
11
+ * @param handle_value callback to transform an individual entry.
11
12
  */
12
- map<NT>($v: ($: T) => NT): Array<NT>;
13
+ map<NT>(handle_value: ($: T) => NT): Array<NT>;
13
14
  /**
14
15
  * maps the array to {@link Async_Value} that contains an array
15
- * @param $v callback that provides an async value. keys are not available.
16
+ * @param handle_value callback that provides an async value. keys are not available.
16
17
  */
17
- async_map<NT>($v: ($: T) => Async_Value<NT>): Async_Value<Array<NT>>;
18
+ map_async<NT>(handle_value: ($: T) => Async_Value<NT>): Async_Value<Array<NT>>;
19
+ map_async_unsafe<NT, NE>(handle_value: ($: T) => Unsafe_Async_Value<NT, NE>): Unsafe_Async_Value<Array<NT>, Array<NE>>;
18
20
  /**
19
21
  * This method is only to be used by resources
20
22
  * iterates over all entries
21
23
  *
22
- * @param $v callback to process the entry
24
+ * @param $handle_value callback to process the entry
23
25
  */
24
- __for_each($v: ($: T) => void): void;
26
+ __for_each(handle_value: ($: T) => void): void;
25
27
  /**
26
28
  * This method is only to be used by resources
27
29
  *
@@ -3,11 +3,12 @@
3
3
  * Similar to the concept of a promise, but with a smaller API.
4
4
  */
5
5
  export interface Async_Value<T> {
6
+ map<NT>(handle_value: ($: T) => NT): Async_Value<NT>;
6
7
  /**
7
8
  * maps the current async value into a new async value
8
9
  * @param handle_value callback that transforms the actual value into a new Async_Value
9
10
  */
10
- map<NT>(handle_value: ($: T) => Async_Value<NT>): Async_Value<NT>;
11
+ then<NT>(handle_value: ($: T) => Async_Value<NT>): Async_Value<NT>;
11
12
  /**
12
13
  * This method is only to be used by resources
13
14
  */
@@ -1,5 +1,6 @@
1
1
  import { Array } from "./Array";
2
2
  import { Async_Value } from "./Async_Value";
3
+ import { Unsafe_Async_Value } from "./Unsafe_Async_Value";
3
4
  import { Optional_Value } from "./Optional_Value";
4
5
  export type Key_Value_Pair<T> = {
5
6
  readonly 'key': string;
@@ -13,14 +14,15 @@ export type Compare_Function<T> = (a: Key_Value_Pair<T>, b: Key_Value_Pair<T>) =
13
14
  export interface Dictionary<T> {
14
15
  /**
15
16
  *
16
- * @param $v callback to transform an individual entry. keys are not available.
17
+ * @param handle_value callback to transform an individual entry. keys are not available.
17
18
  */
18
- map<NT>($v: ($: T, key: string) => NT): Dictionary<NT>;
19
+ map<NT>(handle_value: ($: T, key: string) => NT): Dictionary<NT>;
19
20
  /**
20
21
  *
21
- * @param $v callback that provides an {@link Async_Value}. keys are not available.
22
+ * @param handle_value callback that provides an {@link Async_Value}. keys are not available.
22
23
  */
23
- async_map<NT>($v: ($: T) => Async_Value<NT>): Async_Value<Dictionary<NT>>;
24
+ map_async<NT>(handle_value: ($: T) => Async_Value<NT>): Async_Value<Dictionary<NT>>;
25
+ map_async_unsafe<NT, NE>(handle_value: ($: T) => Unsafe_Async_Value<NT, NE>): Unsafe_Async_Value<Dictionary<NT>, Dictionary<NE>>;
24
26
  /**
25
27
  * This method is only to be used by resources
26
28
  * iterates over all entries in a sorted manner
@@ -0,0 +1,10 @@
1
+ import { Async_Value } from "./Async_Value";
2
+ export interface Unsafe_Async_Value<T, E> {
3
+ map<NT>($v: ($: T) => NT): Unsafe_Async_Value<NT, E>;
4
+ map_exception<NE>($e: ($: E) => NE): Unsafe_Async_Value<T, NE>;
5
+ then<NT>($v: ($: T) => Unsafe_Async_Value<NT, E>): Unsafe_Async_Value<NT, E>;
6
+ if_exception_then<NE>(handle_exception: ($: E) => Unsafe_Async_Value<T, NE>): Unsafe_Async_Value<T, NE>;
7
+ catch($e: ($: E) => T): Async_Value<T>;
8
+ catch_and_map<NT>($v: ($: T) => NT, $e: ($: E) => NT): Async_Value<NT>;
9
+ __start($i: ($: T) => void, $e: ($: E) => void): void;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from "./Computed_Value";
4
4
  export * from "./Dictionary";
5
5
  export * from "./Lookup";
6
6
  export * from "./Optional_Value";
7
+ export * from "./Unsafe_Async_Value";
package/dist/index.js CHANGED
@@ -20,3 +20,4 @@ __exportStar(require("./Computed_Value"), exports);
20
20
  __exportStar(require("./Dictionary"), exports);
21
21
  __exportStar(require("./Lookup"), exports);
22
22
  __exportStar(require("./Optional_Value"), exports);
23
+ __exportStar(require("./Unsafe_Async_Value"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-types",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "core types for Exupery",