exupery-core-data 0.1.3 → 0.1.5
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.
@@ -3,6 +3,7 @@ import * as pt from 'exupery-core-types';
|
|
3
3
|
export type Raw_Or_Normal_Dictionary<T> = {
|
4
4
|
[key: string]: T;
|
5
5
|
} | pt.Dictionary<T>;
|
6
|
+
export type Raw_Or_Normal_Array<T> = T[] | pt.Array<T>;
|
6
7
|
export type Raw_Dictionary<T> = {
|
7
8
|
[key: string]: T;
|
8
9
|
};
|
@@ -10,5 +11,5 @@ export declare const to_raw_array: <T>($: pt.Array<T>) => readonly T[];
|
|
10
11
|
export type Dictionary<T_D> = _et.Dictionary<T_D>;
|
11
12
|
export type List<T_L> = _et.Array<T_L>;
|
12
13
|
export declare const wrap_dictionary: <T>($: Raw_Or_Normal_Dictionary<T>) => Dictionary<T>;
|
13
|
-
export declare const wrap_list: <T>($: T
|
14
|
+
export declare const wrap_list: <T>($: Raw_Or_Normal_Array<T>) => List<T>;
|
14
15
|
export declare const wrap_state_group: <T>($: T) => T;
|
@@ -40,7 +40,13 @@ const wrap_dictionary = ($) => {
|
|
40
40
|
};
|
41
41
|
exports.wrap_dictionary = wrap_dictionary;
|
42
42
|
const wrap_list = ($) => {
|
43
|
-
|
43
|
+
if ($ instanceof Array) {
|
44
|
+
return _ei.array_literal($);
|
45
|
+
}
|
46
|
+
if (!($.__for_each instanceof Function)) {
|
47
|
+
throw new Error("invalid input in 'wrap_list'");
|
48
|
+
}
|
49
|
+
return $;
|
44
50
|
};
|
45
51
|
exports.wrap_list = wrap_list;
|
46
52
|
const wrap_state_group = ($) => {
|
@@ -4,6 +4,7 @@ import * as pt from 'exupery-core-types';
|
|
4
4
|
export type Raw_Or_Normal_Dictionary<T> = {
|
5
5
|
[key: string]: T;
|
6
6
|
} | pt.Dictionary<T>;
|
7
|
+
export type Raw_Or_Normal_Array<T> = T[] | pt.Array<T>;
|
7
8
|
export type Raw_Dictionary<T> = {
|
8
9
|
[key: string]: T;
|
9
10
|
};
|
@@ -32,7 +33,7 @@ export type List<G_Source, T_L> = {
|
|
32
33
|
readonly 'location': G_Source;
|
33
34
|
};
|
34
35
|
export declare const wrap_dictionary: <T>($: Raw_Or_Normal_Dictionary<T>) => Dictionary<_ei.Source_Location, T>;
|
35
|
-
export declare const wrap_list: <T>($: T
|
36
|
+
export declare const wrap_list: <T>($: Raw_Or_Normal_Array<T>) => List<_ei.Source_Location, T>;
|
36
37
|
export declare const wrap_state_group: <T>($: T) => {
|
37
38
|
location: _ei.Source_Location;
|
38
39
|
'state group': T;
|
@@ -28,7 +28,7 @@ const _ei = __importStar(require("exupery-core-internals"));
|
|
28
28
|
const to_raw_array = ($) => $.__get_raw_copy();
|
29
29
|
exports.to_raw_array = to_raw_array;
|
30
30
|
const wrap_dictionary = ($) => {
|
31
|
-
const location = _ei.get_location_info(
|
31
|
+
const location = _ei.get_location_info(1);
|
32
32
|
function is_normal($) {
|
33
33
|
return $.to_array !== undefined && typeof $.to_array === "function";
|
34
34
|
}
|
@@ -53,10 +53,16 @@ const wrap_dictionary = ($) => {
|
|
53
53
|
};
|
54
54
|
exports.wrap_dictionary = wrap_dictionary;
|
55
55
|
const wrap_list = ($) => {
|
56
|
-
const location = _ei.get_location_info(
|
56
|
+
const location = _ei.get_location_info(1);
|
57
|
+
const decorated = $ instanceof Array
|
58
|
+
? _ei.array_literal($)
|
59
|
+
: $;
|
60
|
+
if (!(decorated.__for_each instanceof Function)) {
|
61
|
+
throw new Error("invalid input in 'wrap_list'");
|
62
|
+
}
|
57
63
|
return {
|
58
64
|
'location': location,
|
59
|
-
'list':
|
65
|
+
'list': decorated.map(($) => ({
|
60
66
|
'location': location,
|
61
67
|
'element': $,
|
62
68
|
}))
|
@@ -65,21 +71,21 @@ const wrap_list = ($) => {
|
|
65
71
|
exports.wrap_list = wrap_list;
|
66
72
|
const wrap_state_group = ($) => {
|
67
73
|
return {
|
68
|
-
'location': _ei.get_location_info(
|
74
|
+
'location': _ei.get_location_info(1),
|
69
75
|
'state group': $,
|
70
76
|
};
|
71
77
|
};
|
72
78
|
exports.wrap_state_group = wrap_state_group;
|
73
79
|
const wrap_reference = ($) => {
|
74
80
|
return {
|
75
|
-
'location': _ei.get_location_info(
|
81
|
+
'location': _ei.get_location_info(1),
|
76
82
|
'key': $,
|
77
83
|
};
|
78
84
|
};
|
79
85
|
exports.wrap_reference = wrap_reference;
|
80
86
|
const wrap_stack_reference = (up_steps, name) => {
|
81
87
|
return {
|
82
|
-
'location': _ei.get_location_info(
|
88
|
+
'location': _ei.get_location_info(1),
|
83
89
|
'up steps': up_steps,
|
84
90
|
'key': name,
|
85
91
|
};
|