pacc 8.7.0 → 8.9.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 +12 -5
- package/package.json +3 -3
- package/src/common-attributes.mjs +1 -0
- package/src/expression.mjs +17 -2
- package/types/common-attributes.d.mts +1 -0
- package/types/expression.d.mts +5 -0
package/README.md
CHANGED
|
@@ -100,7 +100,8 @@ const result = expand("${a + 1}",{ root: { a: 2 }});
|
|
|
100
100
|
* [language\_attribute](#language_attribute)
|
|
101
101
|
* [environmentValues](#environmentvalues)
|
|
102
102
|
* [Parameters](#parameters-5)
|
|
103
|
-
* [
|
|
103
|
+
* [expandContextDefault](#expandcontextdefault)
|
|
104
|
+
* [expandContextDoubbleCurly](#expandcontextdoubblecurly)
|
|
104
105
|
* [expand](#expand)
|
|
105
106
|
* [Parameters](#parameters-6)
|
|
106
107
|
* [promises](#promises)
|
|
@@ -463,6 +464,8 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
463
464
|
|
|
464
465
|
## duration\_attribute
|
|
465
466
|
|
|
467
|
+
Duration in seconds.
|
|
468
|
+
|
|
466
469
|
Type: [AttributeDefinition](#attributedefinition)
|
|
467
470
|
|
|
468
471
|
## duration\_attribute\_writable
|
|
@@ -493,10 +496,14 @@ Extract values from environment.
|
|
|
493
496
|
|
|
494
497
|
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
|
|
495
498
|
|
|
496
|
-
##
|
|
499
|
+
## expandContextDefault
|
|
497
500
|
|
|
498
501
|
Default expand context
|
|
499
502
|
|
|
503
|
+
## expandContextDoubbleCurly
|
|
504
|
+
|
|
505
|
+
Expand context with doubble curly separaion '{{' '}}'
|
|
506
|
+
|
|
500
507
|
## expand
|
|
501
508
|
|
|
502
509
|
Expand expressions inside of object graphs.
|
|
@@ -506,10 +513,10 @@ Expand expressions inside of object graphs.
|
|
|
506
513
|
* `object` **any** 
|
|
507
514
|
* `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
508
515
|
|
|
509
|
-
* `context.root` **any
|
|
516
|
+
* `context.root` **any?** actual replacement values
|
|
510
517
|
* `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)
|
|
518
|
+
* `context.leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** starting separator
|
|
519
|
+
* `context.leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** ending separator
|
|
513
520
|
|
|
514
521
|
Returns **(any | [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<any>)** 
|
|
515
522
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
-
"packageManager": "npm@11.
|
|
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.
|
|
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/expression.mjs
CHANGED
|
@@ -43,9 +43,19 @@ export function parseOnly(input, context = {}) {
|
|
|
43
43
|
const nud = (last, left) => {
|
|
44
44
|
switch (last) {
|
|
45
45
|
case OPEN_ROUND: {
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
const sequence = [];
|
|
48
|
+
|
|
49
|
+
while (token !== CLOSE_ROUND) {
|
|
50
|
+
sequence.push(expression(0));
|
|
51
|
+
if (token === COMMA) {
|
|
52
|
+
advance();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
expect(CLOSE_ROUND);
|
|
48
|
-
|
|
56
|
+
|
|
57
|
+
// TODO always a sequence ?
|
|
58
|
+
return sequence.length > 1 ? sequence : sequence[0];
|
|
49
59
|
}
|
|
50
60
|
case OPEN_BRACKET: {
|
|
51
61
|
if (token === CLOSE_BRACKET) {
|
|
@@ -167,6 +177,11 @@ export const globals = {
|
|
|
167
177
|
abs: Math.abs,
|
|
168
178
|
min: Math.min,
|
|
169
179
|
max: Math.max,
|
|
180
|
+
encodeURI: encodeURI,
|
|
181
|
+
decodeURI: decodeURI,
|
|
182
|
+
encodeURIComponent: encodeURIComponent,
|
|
183
|
+
decodeURIComponent: decodeURIComponent,
|
|
184
|
+
trim: a => a.trim(),
|
|
170
185
|
uppercase: a => a.toUpperCase(),
|
|
171
186
|
lowercase: a => a.toLowerCase(),
|
|
172
187
|
substring: (s, a, b) => s.substring(a, b),
|
|
@@ -203,6 +203,7 @@ export const title_attribute_writable: AttributeDefinition;
|
|
|
203
203
|
*/
|
|
204
204
|
export const priority_attribute: AttributeDefinition;
|
|
205
205
|
/**
|
|
206
|
+
* Duration in seconds.
|
|
206
207
|
* @type {AttributeDefinition}
|
|
207
208
|
*/
|
|
208
209
|
export const duration_attribute: AttributeDefinition;
|
package/types/expression.d.mts
CHANGED
|
@@ -8,6 +8,11 @@ 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;
|
|
15
|
+
export function trim(a: any): any;
|
|
11
16
|
export function uppercase(a: any): any;
|
|
12
17
|
export function lowercase(a: any): any;
|
|
13
18
|
export function substring(s: any, a: any, b: any): any;
|