pacc 8.6.3 → 8.7.0
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/README.md +140 -140
- package/package.json +1 -1
- package/src/expand.mjs +14 -5
- package/types/expand.d.mts +14 -3
package/README.md
CHANGED
|
@@ -30,144 +30,140 @@ const result = expand("${a + 1}",{ root: { a: 2 }});
|
|
|
30
30
|
|
|
31
31
|
### Table of Contents
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
- [raiseOnUnknownType](#raiseonunknowntype)
|
|
168
|
-
- [Parameters](#parameters-19)
|
|
169
|
-
- [install](#install)
|
|
170
|
-
- [license](#license)
|
|
33
|
+
* [AST](#ast)
|
|
34
|
+
* [Properties](#properties)
|
|
35
|
+
* [binopError](#binoperror)
|
|
36
|
+
* [Parameters](#parameters)
|
|
37
|
+
* [prepareAttributesDefinitions](#prepareattributesdefinitions)
|
|
38
|
+
* [Parameters](#parameters-1)
|
|
39
|
+
* [mergeAttributeDefinitions](#mergeattributedefinitions)
|
|
40
|
+
* [Parameters](#parameters-2)
|
|
41
|
+
* [attributeIterator](#attributeiterator)
|
|
42
|
+
* [Parameters](#parameters-3)
|
|
43
|
+
* [parseBytes](#parsebytes)
|
|
44
|
+
* [Parameters](#parameters-4)
|
|
45
|
+
* [AttributeDefinition](#attributedefinition)
|
|
46
|
+
* [Properties](#properties-1)
|
|
47
|
+
* [default\_attribute](#default_attribute)
|
|
48
|
+
* [default\_attribute](#default_attribute-1)
|
|
49
|
+
* [default\_attribute](#default_attribute-2)
|
|
50
|
+
* [default\_attribute\_writable](#default_attribute_writable)
|
|
51
|
+
* [default\_attribute\_writable](#default_attribute_writable-1)
|
|
52
|
+
* [default\_attribute\_writable](#default_attribute_writable-2)
|
|
53
|
+
* [default\_attribute\_writable](#default_attribute_writable-3)
|
|
54
|
+
* [string\_collection\_attribute](#string_collection_attribute)
|
|
55
|
+
* [string\_collection\_attribute\_writable](#string_collection_attribute_writable)
|
|
56
|
+
* [string\_set\_attribute](#string_set_attribute)
|
|
57
|
+
* [string\_set\_attribute\_writable](#string_set_attribute_writable)
|
|
58
|
+
* [name\_attribute](#name_attribute)
|
|
59
|
+
* [name\_attribute\_writable](#name_attribute_writable)
|
|
60
|
+
* [email\_attribute](#email_attribute)
|
|
61
|
+
* [version\_attribute](#version_attribute)
|
|
62
|
+
* [version\_attribute\_writable](#version_attribute_writable)
|
|
63
|
+
* [description\_attribute](#description_attribute)
|
|
64
|
+
* [boolean\_attribute](#boolean_attribute)
|
|
65
|
+
* [boolean\_attribute](#boolean_attribute-1)
|
|
66
|
+
* [boolean\_attribute\_writable](#boolean_attribute_writable)
|
|
67
|
+
* [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true)
|
|
68
|
+
* [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true-1)
|
|
69
|
+
* [boolean\_attribute\_writable\_false](#boolean_attribute_writable_false)
|
|
70
|
+
* [boolean\_attribute\_false](#boolean_attribute_false)
|
|
71
|
+
* [yesno\_attribute](#yesno_attribute)
|
|
72
|
+
* [uuid\_attribute](#uuid_attribute)
|
|
73
|
+
* [secret\_attribute](#secret_attribute)
|
|
74
|
+
* [secret\_attribute](#secret_attribute-1)
|
|
75
|
+
* [secret\_attribute](#secret_attribute-2)
|
|
76
|
+
* [secret\_attribute](#secret_attribute-3)
|
|
77
|
+
* [secret\_attribute](#secret_attribute-4)
|
|
78
|
+
* [secret\_attribute\_writable](#secret_attribute_writable)
|
|
79
|
+
* [private\_key\_attribute](#private_key_attribute)
|
|
80
|
+
* [public\_key\_attribute](#public_key_attribute)
|
|
81
|
+
* [number\_attribute](#number_attribute)
|
|
82
|
+
* [number\_attribute\_writable](#number_attribute_writable)
|
|
83
|
+
* [integer\_attribute](#integer_attribute)
|
|
84
|
+
* [integer\_attribute](#integer_attribute-1)
|
|
85
|
+
* [integer\_attribute](#integer_attribute-2)
|
|
86
|
+
* [integer\_attribute\_writable](#integer_attribute_writable)
|
|
87
|
+
* [integer\_attribute\_writable](#integer_attribute_writable-1)
|
|
88
|
+
* [object\_attribute](#object_attribute)
|
|
89
|
+
* [url\_attribute](#url_attribute)
|
|
90
|
+
* [url\_attribute\_writable](#url_attribute_writable)
|
|
91
|
+
* [hostname\_attribute](#hostname_attribute)
|
|
92
|
+
* [port\_attribute](#port_attribute)
|
|
93
|
+
* [id\_attribute](#id_attribute)
|
|
94
|
+
* [title\_attribute\_writable](#title_attribute_writable)
|
|
95
|
+
* [priority\_attribute](#priority_attribute)
|
|
96
|
+
* [duration\_attribute](#duration_attribute)
|
|
97
|
+
* [duration\_attribute\_writable](#duration_attribute_writable)
|
|
98
|
+
* [duration\_ms\_attribute](#duration_ms_attribute)
|
|
99
|
+
* [timeout\_attribute](#timeout_attribute)
|
|
100
|
+
* [language\_attribute](#language_attribute)
|
|
101
|
+
* [environmentValues](#environmentvalues)
|
|
102
|
+
* [Parameters](#parameters-5)
|
|
103
|
+
* [defaultExpandContext](#defaultexpandcontext)
|
|
104
|
+
* [expand](#expand)
|
|
105
|
+
* [Parameters](#parameters-6)
|
|
106
|
+
* [promises](#promises)
|
|
107
|
+
* [filter](#filter)
|
|
108
|
+
* [Parameters](#parameters-7)
|
|
109
|
+
* [setAttributes](#setattributes)
|
|
110
|
+
* [Parameters](#parameters-8)
|
|
111
|
+
* [getAttributes](#getattributes)
|
|
112
|
+
* [Parameters](#parameters-9)
|
|
113
|
+
* [getAttributesJSON](#getattributesjson)
|
|
114
|
+
* [Parameters](#parameters-10)
|
|
115
|
+
* [tokens](#tokens)
|
|
116
|
+
* [tokens](#tokens-1)
|
|
117
|
+
* [Parameters](#parameters-11)
|
|
118
|
+
* [setAttribute](#setattribute)
|
|
119
|
+
* [Parameters](#parameters-12)
|
|
120
|
+
* [getAttribute](#getattribute)
|
|
121
|
+
* [Parameters](#parameters-13)
|
|
122
|
+
* [getAttributeAndOperator](#getattributeandoperator)
|
|
123
|
+
* [Parameters](#parameters-14)
|
|
124
|
+
* [parseDuration](#parseduration)
|
|
125
|
+
* [Parameters](#parameters-15)
|
|
126
|
+
* [formatDuration](#formatduration)
|
|
127
|
+
* [Parameters](#parameters-16)
|
|
128
|
+
* [formatDurationISO](#formatdurationiso)
|
|
129
|
+
* [Parameters](#parameters-17)
|
|
130
|
+
* [lookup](#lookup)
|
|
131
|
+
* [Token](#token)
|
|
132
|
+
* [Properties](#properties-2)
|
|
133
|
+
* [createToken](#createtoken)
|
|
134
|
+
* [Parameters](#parameters-18)
|
|
135
|
+
* [PLUS](#plus)
|
|
136
|
+
* [MINUS](#minus)
|
|
137
|
+
* [STAR](#star)
|
|
138
|
+
* [DIVIDE](#divide)
|
|
139
|
+
* [NOT](#not)
|
|
140
|
+
* [NOT\_EQUAL](#not_equal)
|
|
141
|
+
* [EQUAL](#equal)
|
|
142
|
+
* [GREATER](#greater)
|
|
143
|
+
* [GREATER\_EQUAL](#greater_equal)
|
|
144
|
+
* [LESS](#less)
|
|
145
|
+
* [LESS\_EQUAL](#less_equal)
|
|
146
|
+
* [OPEN\_ROUND](#open_round)
|
|
147
|
+
* [CLOSE\_ROUND](#close_round)
|
|
148
|
+
* [OPEN\_BRACKET](#open_bracket)
|
|
149
|
+
* [CLOSE\_BRACKET](#close_bracket)
|
|
150
|
+
* [OPEN\_CURLY](#open_curly)
|
|
151
|
+
* [CLOSE\_CURLY](#close_curly)
|
|
152
|
+
* [QUESTION](#question)
|
|
153
|
+
* [COLON](#colon)
|
|
154
|
+
* [SEMICOLON](#semicolon)
|
|
155
|
+
* [COMMA](#comma)
|
|
156
|
+
* [DOT](#dot)
|
|
157
|
+
* [AMPERSAND](#ampersand)
|
|
158
|
+
* [DOUBLE\_AMPERSAND](#double_ampersand)
|
|
159
|
+
* [BAR](#bar)
|
|
160
|
+
* [DOUBLE\_BAR](#double_bar)
|
|
161
|
+
* [IDENTIFIER](#identifier)
|
|
162
|
+
* [EOF](#eof)
|
|
163
|
+
* [Type](#type)
|
|
164
|
+
* [Properties](#properties-3)
|
|
165
|
+
* [raiseOnUnknownType](#raiseonunknowntype)
|
|
166
|
+
* [Parameters](#parameters-19)
|
|
171
167
|
|
|
172
168
|
## AST
|
|
173
169
|
|
|
@@ -497,6 +493,10 @@ Extract values from environment.
|
|
|
497
493
|
|
|
498
494
|
Returns **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** undefined if no suitable environment variables have been found
|
|
499
495
|
|
|
496
|
+
## defaultExpandContext
|
|
497
|
+
|
|
498
|
+
Default expand context
|
|
499
|
+
|
|
500
500
|
## expand
|
|
501
501
|
|
|
502
502
|
Expand expressions inside of object graphs.
|
|
@@ -504,14 +504,14 @@ Expand expressions inside of object graphs.
|
|
|
504
504
|
### Parameters
|
|
505
505
|
|
|
506
506
|
* `object` **any** 
|
|
507
|
-
* `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
507
|
+
* `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
508
508
|
|
|
509
509
|
* `context.root` **any?** 
|
|
510
510
|
* `context.stopClass` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
511
511
|
* `context.leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
512
512
|
* `context.leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
513
513
|
|
|
514
|
-
Returns **any** 
|
|
514
|
+
Returns **(any | [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<any>)** 
|
|
515
515
|
|
|
516
516
|
## promises
|
|
517
517
|
|
package/package.json
CHANGED
package/src/expand.mjs
CHANGED
|
@@ -5,26 +5,35 @@ const maxNestingLevel = 8;
|
|
|
5
5
|
/**
|
|
6
6
|
* Default expand context
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
export const expandContextDefault = {
|
|
9
9
|
root: {},
|
|
10
10
|
leadIn: "${",
|
|
11
11
|
leadOut: "}"
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Expand context with doubble curly separaion '{{' '}}'
|
|
16
|
+
*/
|
|
17
|
+
export const expandContextDoubbleCurly = {
|
|
18
|
+
...expandContextDefault,
|
|
19
|
+
leadIn: "{{",
|
|
20
|
+
leadOut: "}}"
|
|
21
|
+
};
|
|
22
|
+
|
|
14
23
|
/**
|
|
15
24
|
* Expand expressions inside of object graphs.
|
|
16
25
|
* @param {any} object
|
|
17
26
|
* @param {Object} context
|
|
18
|
-
* @param {any} [context.root]
|
|
27
|
+
* @param {any} [context.root] actual replacement values
|
|
19
28
|
* @param {function} [context.stopClass]
|
|
20
|
-
* @param {string} [context.leadIn]
|
|
21
|
-
* @param {string} [context.leadOut]
|
|
29
|
+
* @param {string} [context.leadIn] starting separator
|
|
30
|
+
* @param {string} [context.leadOut] ending separator
|
|
22
31
|
* @returns {any|Promise<any>}
|
|
23
32
|
*/
|
|
24
33
|
export function expand(object, context) {
|
|
25
34
|
const /** @type {Array<Promise<any>>} */ promises = [];
|
|
26
35
|
|
|
27
|
-
context = Object.assign({},
|
|
36
|
+
context = Object.assign({}, expandContextDefault, context);
|
|
28
37
|
const leadIn = context.leadIn;
|
|
29
38
|
const leadOut = context.leadOut;
|
|
30
39
|
|
package/types/expand.d.mts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Expand expressions inside of object graphs.
|
|
3
3
|
* @param {any} object
|
|
4
4
|
* @param {Object} context
|
|
5
|
-
* @param {any} [context.root]
|
|
5
|
+
* @param {any} [context.root] actual replacement values
|
|
6
6
|
* @param {function} [context.stopClass]
|
|
7
|
-
* @param {string} [context.leadIn]
|
|
8
|
-
* @param {string} [context.leadOut]
|
|
7
|
+
* @param {string} [context.leadIn] starting separator
|
|
8
|
+
* @param {string} [context.leadOut] ending separator
|
|
9
9
|
* @returns {any|Promise<any>}
|
|
10
10
|
*/
|
|
11
11
|
export function expand(object: any, context: {
|
|
@@ -14,3 +14,14 @@ export function expand(object: any, context: {
|
|
|
14
14
|
leadIn?: string;
|
|
15
15
|
leadOut?: string;
|
|
16
16
|
}): any | Promise<any>;
|
|
17
|
+
export namespace expandContextDefault {
|
|
18
|
+
let root: {};
|
|
19
|
+
let leadIn: string;
|
|
20
|
+
let leadOut: string;
|
|
21
|
+
}
|
|
22
|
+
export namespace expandContextDoubbleCurly {
|
|
23
|
+
let leadIn_1: string;
|
|
24
|
+
export { leadIn_1 as leadIn };
|
|
25
|
+
let leadOut_1: string;
|
|
26
|
+
export { leadOut_1 as leadOut };
|
|
27
|
+
}
|