pacc 9.0.0 → 9.1.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 +7 -6
- package/package.json +2 -1
- package/src/tokens.mjs +9 -2
- package/types/tokens.d.mts +2 -0
package/README.md
CHANGED
|
@@ -546,6 +546,7 @@ Retrive attribute values from an object.
|
|
|
546
546
|
|
|
547
547
|
* `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute value source
|
|
548
548
|
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
549
|
+
* `filter` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
549
550
|
|
|
550
551
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
|
|
551
552
|
|
|
@@ -565,12 +566,12 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
565
566
|
|
|
566
567
|
## tokens
|
|
567
568
|
|
|
568
|
-
Split
|
|
569
|
+
Split expression path into tokens.
|
|
569
570
|
|
|
570
571
|
### Parameters
|
|
571
572
|
|
|
572
573
|
* `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
573
|
-
* `
|
|
574
|
+
* `context` (optional, default `{}`)
|
|
574
575
|
|
|
575
576
|
## setAttribute
|
|
576
577
|
|
|
@@ -582,7 +583,7 @@ The name may be a property path like 'a.b.c'.
|
|
|
582
583
|
* `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
583
584
|
* `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
584
585
|
* `value` **any** 
|
|
585
|
-
* `definition` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
586
|
+
* `definition` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** type def
|
|
586
587
|
|
|
587
588
|
## getAttribute
|
|
588
589
|
|
|
@@ -593,7 +594,7 @@ The name may be a property path like 'a.b.c' or a\[2]
|
|
|
593
594
|
|
|
594
595
|
* `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
595
596
|
* `expression` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
596
|
-
* `definition`
|
|
597
|
+
* `definition` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
597
598
|
|
|
598
599
|
Returns **any** value associated with the given property name
|
|
599
600
|
|
|
@@ -654,8 +655,8 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
654
655
|
* `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
655
656
|
* `precedence` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** (optional, default `0`)
|
|
656
657
|
* `type` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
657
|
-
* `led` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** (optional, default `()=>
|
|
658
|
-
* `nud` (optional, default `
|
|
658
|
+
* `led` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** (optional, default `(parser,node)=>node`)
|
|
659
|
+
* `nud` (optional, default `parser=>this`)
|
|
659
660
|
|
|
660
661
|
Returns **[Token](#token)** 
|
|
661
662
|
|
package/package.json
CHANGED
package/src/tokens.mjs
CHANGED
|
@@ -337,7 +337,14 @@ export const globals = {
|
|
|
337
337
|
args
|
|
338
338
|
.map(item => (item instanceof Iterator ? Array.from(item) : item))
|
|
339
339
|
.flat()
|
|
340
|
-
.join(separator)
|
|
340
|
+
.join(separator),
|
|
341
|
+
sort: data => {
|
|
342
|
+
return data.sort();
|
|
343
|
+
},
|
|
344
|
+
truncate: (data, length) => {
|
|
345
|
+
data.length = length;
|
|
346
|
+
return data;
|
|
347
|
+
}
|
|
341
348
|
};
|
|
342
349
|
|
|
343
350
|
/**
|
|
@@ -349,7 +356,7 @@ export const globals = {
|
|
|
349
356
|
export function* tokens(string, context = {}) {
|
|
350
357
|
context.keywords ||= keywords;
|
|
351
358
|
context.parseFloat ||= parseFloat;
|
|
352
|
-
context.valueFor ||= (name,at) => globals[name];
|
|
359
|
+
context.valueFor ||= (name, at) => globals[name];
|
|
353
360
|
|
|
354
361
|
let state, value, hex, quote;
|
|
355
362
|
|
package/types/tokens.d.mts
CHANGED
|
@@ -64,6 +64,8 @@ export namespace globals {
|
|
|
64
64
|
export function substring(s: any, a: any, b: any): any;
|
|
65
65
|
export function length(s: any): any;
|
|
66
66
|
export function join(separator: any, ...args: any[]): string;
|
|
67
|
+
export function sort(data: any): any;
|
|
68
|
+
export function truncate(data: any, length: any): any;
|
|
67
69
|
}
|
|
68
70
|
export type Token = {
|
|
69
71
|
str: string;
|