exupery-core-types 0.1.2 → 0.1.3
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
|
|
11
|
+
* @param handle_value callback to transform an individual entry.
|
|
11
12
|
*/
|
|
12
|
-
map<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
|
|
16
|
+
* @param handle_value callback that provides an async value. keys are not available.
|
|
16
17
|
*/
|
|
17
|
-
|
|
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 $
|
|
24
|
+
* @param $handle_value callback to process the entry
|
|
23
25
|
*/
|
|
24
|
-
__for_each(
|
|
26
|
+
__for_each(handle_value: ($: T) => void): void;
|
|
25
27
|
/**
|
|
26
28
|
* This method is only to be used by resources
|
|
27
29
|
*
|
package/dist/Async_Value.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
*/
|
package/dist/Dictionary.d.ts
CHANGED
|
@@ -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
|
|
17
|
+
* @param handle_value callback to transform an individual entry. keys are not available.
|
|
17
18
|
*/
|
|
18
|
-
map<NT>(
|
|
19
|
+
map<NT>(handle_value: ($: T, key: string) => NT): Dictionary<NT>;
|
|
19
20
|
/**
|
|
20
21
|
*
|
|
21
|
-
* @param
|
|
22
|
+
* @param handle_value callback that provides an {@link Async_Value}. keys are not available.
|
|
22
23
|
*/
|
|
23
|
-
|
|
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
|
+
}
|