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 CHANGED
@@ -30,144 +30,140 @@ const result = expand("${a + 1}",{ root: { a: 2 }});
30
30
 
31
31
  ### Table of Contents
32
32
 
33
- - [pacc](#pacc)
34
- - [API](#api)
35
- - [Table of Contents](#table-of-contents)
36
- - [AST](#ast)
37
- - [Properties](#properties)
38
- - [binopError](#binoperror)
39
- - [Parameters](#parameters)
40
- - [prepareAttributesDefinitions](#prepareattributesdefinitions)
41
- - [Parameters](#parameters-1)
42
- - [mergeAttributeDefinitions](#mergeattributedefinitions)
43
- - [Parameters](#parameters-2)
44
- - [attributeIterator](#attributeiterator)
45
- - [Parameters](#parameters-3)
46
- - [parseBytes](#parsebytes)
47
- - [Parameters](#parameters-4)
48
- - [AttributeDefinition](#attributedefinition)
49
- - [Properties](#properties-1)
50
- - [default\_attribute](#default_attribute)
51
- - [default\_attribute](#default_attribute-1)
52
- - [default\_attribute](#default_attribute-2)
53
- - [default\_attribute\_writable](#default_attribute_writable)
54
- - [default\_attribute\_writable](#default_attribute_writable-1)
55
- - [default\_attribute\_writable](#default_attribute_writable-2)
56
- - [default\_attribute\_writable](#default_attribute_writable-3)
57
- - [string\_collection\_attribute](#string_collection_attribute)
58
- - [string\_collection\_attribute\_writable](#string_collection_attribute_writable)
59
- - [string\_set\_attribute](#string_set_attribute)
60
- - [string\_set\_attribute\_writable](#string_set_attribute_writable)
61
- - [name\_attribute](#name_attribute)
62
- - [name\_attribute\_writable](#name_attribute_writable)
63
- - [email\_attribute](#email_attribute)
64
- - [version\_attribute](#version_attribute)
65
- - [version\_attribute\_writable](#version_attribute_writable)
66
- - [description\_attribute](#description_attribute)
67
- - [boolean\_attribute](#boolean_attribute)
68
- - [boolean\_attribute](#boolean_attribute-1)
69
- - [boolean\_attribute\_writable](#boolean_attribute_writable)
70
- - [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true)
71
- - [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true-1)
72
- - [boolean\_attribute\_writable\_false](#boolean_attribute_writable_false)
73
- - [boolean\_attribute\_false](#boolean_attribute_false)
74
- - [yesno\_attribute](#yesno_attribute)
75
- - [uuid\_attribute](#uuid_attribute)
76
- - [secret\_attribute](#secret_attribute)
77
- - [secret\_attribute](#secret_attribute-1)
78
- - [secret\_attribute](#secret_attribute-2)
79
- - [secret\_attribute](#secret_attribute-3)
80
- - [secret\_attribute](#secret_attribute-4)
81
- - [secret\_attribute\_writable](#secret_attribute_writable)
82
- - [private\_key\_attribute](#private_key_attribute)
83
- - [public\_key\_attribute](#public_key_attribute)
84
- - [number\_attribute](#number_attribute)
85
- - [number\_attribute\_writable](#number_attribute_writable)
86
- - [integer\_attribute](#integer_attribute)
87
- - [integer\_attribute](#integer_attribute-1)
88
- - [integer\_attribute](#integer_attribute-2)
89
- - [integer\_attribute\_writable](#integer_attribute_writable)
90
- - [integer\_attribute\_writable](#integer_attribute_writable-1)
91
- - [object\_attribute](#object_attribute)
92
- - [url\_attribute](#url_attribute)
93
- - [url\_attribute\_writable](#url_attribute_writable)
94
- - [hostname\_attribute](#hostname_attribute)
95
- - [port\_attribute](#port_attribute)
96
- - [id\_attribute](#id_attribute)
97
- - [title\_attribute\_writable](#title_attribute_writable)
98
- - [priority\_attribute](#priority_attribute)
99
- - [duration\_attribute](#duration_attribute)
100
- - [duration\_attribute\_writable](#duration_attribute_writable)
101
- - [duration\_ms\_attribute](#duration_ms_attribute)
102
- - [timeout\_attribute](#timeout_attribute)
103
- - [language\_attribute](#language_attribute)
104
- - [environmentValues](#environmentvalues)
105
- - [Parameters](#parameters-5)
106
- - [expand](#expand)
107
- - [Parameters](#parameters-6)
108
- - [promises](#promises)
109
- - [filter](#filter)
110
- - [Parameters](#parameters-7)
111
- - [setAttributes](#setattributes)
112
- - [Parameters](#parameters-8)
113
- - [getAttributes](#getattributes)
114
- - [Parameters](#parameters-9)
115
- - [getAttributesJSON](#getattributesjson)
116
- - [Parameters](#parameters-10)
117
- - [tokens](#tokens)
118
- - [tokens](#tokens-1)
119
- - [Parameters](#parameters-11)
120
- - [setAttribute](#setattribute)
121
- - [Parameters](#parameters-12)
122
- - [getAttribute](#getattribute)
123
- - [Parameters](#parameters-13)
124
- - [getAttributeAndOperator](#getattributeandoperator)
125
- - [Parameters](#parameters-14)
126
- - [parseDuration](#parseduration)
127
- - [Parameters](#parameters-15)
128
- - [formatDuration](#formatduration)
129
- - [Parameters](#parameters-16)
130
- - [formatDurationISO](#formatdurationiso)
131
- - [Parameters](#parameters-17)
132
- - [lookup](#lookup)
133
- - [Token](#token)
134
- - [Properties](#properties-2)
135
- - [createToken](#createtoken)
136
- - [Parameters](#parameters-18)
137
- - [PLUS](#plus)
138
- - [MINUS](#minus)
139
- - [STAR](#star)
140
- - [DIVIDE](#divide)
141
- - [NOT](#not)
142
- - [NOT\_EQUAL](#not_equal)
143
- - [EQUAL](#equal)
144
- - [GREATER](#greater)
145
- - [GREATER\_EQUAL](#greater_equal)
146
- - [LESS](#less)
147
- - [LESS\_EQUAL](#less_equal)
148
- - [OPEN\_ROUND](#open_round)
149
- - [CLOSE\_ROUND](#close_round)
150
- - [OPEN\_BRACKET](#open_bracket)
151
- - [CLOSE\_BRACKET](#close_bracket)
152
- - [OPEN\_CURLY](#open_curly)
153
- - [CLOSE\_CURLY](#close_curly)
154
- - [QUESTION](#question)
155
- - [COLON](#colon)
156
- - [SEMICOLON](#semicolon)
157
- - [COMMA](#comma)
158
- - [DOT](#dot)
159
- - [AMPERSAND](#ampersand)
160
- - [DOUBLE\_AMPERSAND](#double_ampersand)
161
- - [BAR](#bar)
162
- - [DOUBLE\_BAR](#double_bar)
163
- - [IDENTIFIER](#identifier)
164
- - [EOF](#eof)
165
- - [Type](#type)
166
- - [Properties](#properties-3)
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)** (optional, default `{}`)
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>)**&#x20;
515
515
 
516
516
  ## promises
517
517
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "8.6.3",
3
+ "version": "8.7.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
package/src/expand.mjs CHANGED
@@ -5,26 +5,35 @@ const maxNestingLevel = 8;
5
5
  /**
6
6
  * Default expand context
7
7
  */
8
- const defaultExpandContext = {
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({}, defaultExpandContext, context);
36
+ context = Object.assign({}, expandContextDefault, context);
28
37
  const leadIn = context.leadIn;
29
38
  const leadOut = context.leadOut;
30
39
 
@@ -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
+ }