pacc 8.6.3 → 8.8.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,141 @@ 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
+ * [expandContextDefault](#expandcontextdefault)
104
+ * [expandContextDoubbleCurly](#expandcontextdoubblecurly)
105
+ * [expand](#expand)
106
+ * [Parameters](#parameters-6)
107
+ * [promises](#promises)
108
+ * [filter](#filter)
109
+ * [Parameters](#parameters-7)
110
+ * [setAttributes](#setattributes)
111
+ * [Parameters](#parameters-8)
112
+ * [getAttributes](#getattributes)
113
+ * [Parameters](#parameters-9)
114
+ * [getAttributesJSON](#getattributesjson)
115
+ * [Parameters](#parameters-10)
116
+ * [tokens](#tokens)
117
+ * [tokens](#tokens-1)
118
+ * [Parameters](#parameters-11)
119
+ * [setAttribute](#setattribute)
120
+ * [Parameters](#parameters-12)
121
+ * [getAttribute](#getattribute)
122
+ * [Parameters](#parameters-13)
123
+ * [getAttributeAndOperator](#getattributeandoperator)
124
+ * [Parameters](#parameters-14)
125
+ * [parseDuration](#parseduration)
126
+ * [Parameters](#parameters-15)
127
+ * [formatDuration](#formatduration)
128
+ * [Parameters](#parameters-16)
129
+ * [formatDurationISO](#formatdurationiso)
130
+ * [Parameters](#parameters-17)
131
+ * [lookup](#lookup)
132
+ * [Token](#token)
133
+ * [Properties](#properties-2)
134
+ * [createToken](#createtoken)
135
+ * [Parameters](#parameters-18)
136
+ * [PLUS](#plus)
137
+ * [MINUS](#minus)
138
+ * [STAR](#star)
139
+ * [DIVIDE](#divide)
140
+ * [NOT](#not)
141
+ * [NOT\_EQUAL](#not_equal)
142
+ * [EQUAL](#equal)
143
+ * [GREATER](#greater)
144
+ * [GREATER\_EQUAL](#greater_equal)
145
+ * [LESS](#less)
146
+ * [LESS\_EQUAL](#less_equal)
147
+ * [OPEN\_ROUND](#open_round)
148
+ * [CLOSE\_ROUND](#close_round)
149
+ * [OPEN\_BRACKET](#open_bracket)
150
+ * [CLOSE\_BRACKET](#close_bracket)
151
+ * [OPEN\_CURLY](#open_curly)
152
+ * [CLOSE\_CURLY](#close_curly)
153
+ * [QUESTION](#question)
154
+ * [COLON](#colon)
155
+ * [SEMICOLON](#semicolon)
156
+ * [COMMA](#comma)
157
+ * [DOT](#dot)
158
+ * [AMPERSAND](#ampersand)
159
+ * [DOUBLE\_AMPERSAND](#double_ampersand)
160
+ * [BAR](#bar)
161
+ * [DOUBLE\_BAR](#double_bar)
162
+ * [IDENTIFIER](#identifier)
163
+ * [EOF](#eof)
164
+ * [Type](#type)
165
+ * [Properties](#properties-3)
166
+ * [raiseOnUnknownType](#raiseonunknowntype)
167
+ * [Parameters](#parameters-19)
171
168
 
172
169
  ## AST
173
170
 
@@ -497,6 +494,14 @@ Extract values from environment.
497
494
 
498
495
  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
496
 
497
+ ## expandContextDefault
498
+
499
+ Default expand context
500
+
501
+ ## expandContextDoubbleCurly
502
+
503
+ Expand context with doubble curly separaion '{{' '}}'
504
+
500
505
  ## expand
501
506
 
502
507
  Expand expressions inside of object graphs.
@@ -504,14 +509,14 @@ Expand expressions inside of object graphs.
504
509
  ### Parameters
505
510
 
506
511
  * `object` **any** 
507
- * `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
512
+ * `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
508
513
 
509
- * `context.root` **any?** 
514
+ * `context.root` **any?** actual replacement values
510
515
  * `context.stopClass` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
511
- * `context.leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
512
- * `context.leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
516
+ * `context.leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** starting separator
517
+ * `context.leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** ending separator
513
518
 
514
- Returns **any** 
519
+ Returns **(any | [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<any>)**&#x20;
515
520
 
516
521
  ## promises
517
522
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "8.6.3",
3
+ "version": "8.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
- "packageManager": "npm@11.6.4+sha512.1118cab46a05a50aee6bff5b1b4fa1df18afff89d57465620a3518035026955db87c5bdf9d207b07b7487d99f2490d450cb774655ad63ec2cba7bf1d0ad25d45",
8
+ "packageManager": "npm@11.9.0+sha512.04166853ddba142ca98f86fb57b1258a7c6c59ccb82acb3cf141b77a315898acaaed47395e74f7e0c7b69c486008e68be6a6381ef1aee5a23dd82e0e61decd68",
9
9
  "types": "./types/module.d.mts",
10
10
  "exports": {
11
11
  ".": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "ava": "^6.4.1",
44
- "browser-ava": "^2.3.52",
44
+ "browser-ava": "^2.3.53",
45
45
  "c8": "^10.1.3",
46
46
  "documentation": "^14.0.3",
47
47
  "semantic-release": "^25.0.3",
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
 
@@ -167,6 +167,10 @@ export const globals = {
167
167
  abs: Math.abs,
168
168
  min: Math.min,
169
169
  max: Math.max,
170
+ encodeURI: encodeURI,
171
+ decodeURI: decodeURI,
172
+ encodeURIComponent: encodeURIComponent,
173
+ decodeURIComponent: decodeURIComponent,
170
174
  uppercase: a => a.toUpperCase(),
171
175
  lowercase: a => a.toLowerCase(),
172
176
  substring: (s, a, b) => s.substring(a, b),
@@ -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
+ }
@@ -8,6 +8,10 @@ export namespace globals {
8
8
  export let abs: (x: number) => number;
9
9
  export let min: (...values: number[]) => number;
10
10
  export let max: (...values: number[]) => number;
11
+ export let encodeURI: typeof globalThis.encodeURI;
12
+ export let decodeURI: typeof globalThis.decodeURI;
13
+ export let encodeURIComponent: typeof globalThis.encodeURIComponent;
14
+ export let decodeURIComponent: typeof globalThis.decodeURIComponent;
11
15
  export function uppercase(a: any): any;
12
16
  export function lowercase(a: any): any;
13
17
  export function substring(s: any, a: any, b: any): any;