pacc 6.6.3 → 6.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 +19 -3
- package/package.json +1 -1
- package/src/attributes.mjs +1 -1
- package/src/common-attributes.mjs +8 -0
- package/src/multiple.mjs +1 -1
- package/types/attributes.d.mts +2 -2
- package/types/common-attributes.d.mts +4 -0
- package/types/multiple.d.mts +2 -2
package/README.md
CHANGED
|
@@ -88,6 +88,7 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
88
88
|
* [Parameters](#parameters-4)
|
|
89
89
|
* [expand](#expand)
|
|
90
90
|
* [Parameters](#parameters-5)
|
|
91
|
+
* [promises](#promises)
|
|
91
92
|
* [filter](#filter)
|
|
92
93
|
* [Parameters](#parameters-6)
|
|
93
94
|
* [setAttributes](#setattributes)
|
|
@@ -146,6 +147,8 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
146
147
|
* [EOF](#eof)
|
|
147
148
|
* [Type](#type)
|
|
148
149
|
* [Properties](#properties-2)
|
|
150
|
+
* [raiseOnUnknownType](#raiseonunknowntype)
|
|
151
|
+
* [Parameters](#parameters-18)
|
|
149
152
|
|
|
150
153
|
## prepareAttributesDefinitions
|
|
151
154
|
|
|
@@ -176,7 +179,7 @@ Iterate over all attributes.
|
|
|
176
179
|
### Parameters
|
|
177
180
|
|
|
178
181
|
* `definition` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
179
|
-
* `filter` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)
|
|
182
|
+
* `filter` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
180
183
|
* `path` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** (optional, default `[]`)
|
|
181
184
|
|
|
182
185
|
Returns **Iterable<\[[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>, [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)]>** 
|
|
@@ -442,13 +445,17 @@ Expand expressions inside of object graphs.
|
|
|
442
445
|
* `object` **any** 
|
|
443
446
|
* `context` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`)
|
|
444
447
|
|
|
445
|
-
* `context.root` **any
|
|
448
|
+
* `context.root` **any?** 
|
|
446
449
|
* `context.stopClass` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
447
450
|
* `context.leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
448
451
|
* `context.leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** 
|
|
449
452
|
|
|
450
453
|
Returns **any** 
|
|
451
454
|
|
|
455
|
+
## promises
|
|
456
|
+
|
|
457
|
+
Type: [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<any>>
|
|
458
|
+
|
|
452
459
|
## filter
|
|
453
460
|
|
|
454
461
|
Generate filter function.
|
|
@@ -489,7 +496,7 @@ Retrive attribute values from an object.
|
|
|
489
496
|
|
|
490
497
|
* `object` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute value source
|
|
491
498
|
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
492
|
-
* `filter` **[
|
|
499
|
+
* `filter` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
493
500
|
|
|
494
501
|
Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** values
|
|
495
502
|
|
|
@@ -710,6 +717,15 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
|
|
|
710
717
|
* `primitive` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** 
|
|
711
718
|
* `prepareValue` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** 
|
|
712
719
|
|
|
720
|
+
## raiseOnUnknownType
|
|
721
|
+
|
|
722
|
+
### Parameters
|
|
723
|
+
|
|
724
|
+
* `type` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined))** 
|
|
725
|
+
* `origin` **any** 
|
|
726
|
+
|
|
727
|
+
Returns **[Type](#type)** 
|
|
728
|
+
|
|
713
729
|
# install
|
|
714
730
|
|
|
715
731
|
With [npm](http://npmjs.org) do:
|
package/package.json
CHANGED
package/src/attributes.mjs
CHANGED
|
@@ -47,7 +47,7 @@ function mergeAttributeDefinitions(dest, atts) {
|
|
|
47
47
|
/**
|
|
48
48
|
* Iterate over all attributes.
|
|
49
49
|
* @param {Object} definition
|
|
50
|
-
* @param {Function} filter
|
|
50
|
+
* @param {Function} [filter]
|
|
51
51
|
* @param {string[]} path
|
|
52
52
|
* @return {Iterable<[string[],object]>}
|
|
53
53
|
*/
|
|
@@ -367,6 +367,14 @@ export const duration_attribute = {
|
|
|
367
367
|
type: types.duration
|
|
368
368
|
};
|
|
369
369
|
|
|
370
|
+
/**
|
|
371
|
+
* @type {AttributeDefinition}
|
|
372
|
+
*/
|
|
373
|
+
export const duration_attribute_writable = {
|
|
374
|
+
...duration_attribute,
|
|
375
|
+
writable: true
|
|
376
|
+
};
|
|
377
|
+
|
|
370
378
|
/**
|
|
371
379
|
* @type {AttributeDefinition}
|
|
372
380
|
*/
|
package/src/multiple.mjs
CHANGED
|
@@ -60,7 +60,7 @@ export function getAttributes(object, definitions) {
|
|
|
60
60
|
* Retrive attribute values from an object.
|
|
61
61
|
* @param {Object} object attribute value source
|
|
62
62
|
* @param {Object} definitions
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {Function} [filter]
|
|
64
64
|
* @return {Object} values
|
|
65
65
|
*/
|
|
66
66
|
export function getAttributesJSON(object, definitions, filter) {
|
package/types/attributes.d.mts
CHANGED
|
@@ -8,11 +8,11 @@ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinit
|
|
|
8
8
|
/**
|
|
9
9
|
* Iterate over all attributes.
|
|
10
10
|
* @param {Object} definition
|
|
11
|
-
* @param {Function} filter
|
|
11
|
+
* @param {Function} [filter]
|
|
12
12
|
* @param {string[]} path
|
|
13
13
|
* @return {Iterable<[string[],object]>}
|
|
14
14
|
*/
|
|
15
|
-
export function attributeIterator(definition: any, filter
|
|
15
|
+
export function attributeIterator(definition: any, filter?: Function, path?: string[]): Iterable<[string[], object]>;
|
|
16
16
|
export function writableAttributeIterator(definition: any): Generator<[string[], any], void, any>;
|
|
17
17
|
export function prepareValue(value: any, attribute: any): any;
|
|
18
18
|
export function mandatoryAttributesPresent(object: any, attributes: any): boolean;
|
|
@@ -186,6 +186,10 @@ export const priority_attribute: AttributeDefinition;
|
|
|
186
186
|
* @type {AttributeDefinition}
|
|
187
187
|
*/
|
|
188
188
|
export const duration_attribute: AttributeDefinition;
|
|
189
|
+
/**
|
|
190
|
+
* @type {AttributeDefinition}
|
|
191
|
+
*/
|
|
192
|
+
export const duration_attribute_writable: AttributeDefinition;
|
|
189
193
|
/**
|
|
190
194
|
* @type {AttributeDefinition}
|
|
191
195
|
*/
|
package/types/multiple.d.mts
CHANGED
|
@@ -17,7 +17,7 @@ export function getAttributes(object: any, definitions: any): any;
|
|
|
17
17
|
* Retrive attribute values from an object.
|
|
18
18
|
* @param {Object} object attribute value source
|
|
19
19
|
* @param {Object} definitions
|
|
20
|
-
* @param {
|
|
20
|
+
* @param {Function} [filter]
|
|
21
21
|
* @return {Object} values
|
|
22
22
|
*/
|
|
23
|
-
export function getAttributesJSON(object: any, definitions: any, filter
|
|
23
|
+
export function getAttributesJSON(object: any, definitions: any, filter?: Function): any;
|