pacc 4.34.3 → 4.36.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.34.3",
3
+ "version": "4.36.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -66,8 +66,10 @@ export function* attributeIterator(definition, filter, path = []) {
66
66
  }
67
67
  }
68
68
 
69
+ export const filterWritable = (name, attribute) => attribute.writable;
70
+
69
71
  export function* writableAttributeIterator(definition) {
70
- yield* attributeIterator(definition, (name, def) => def.writable);
72
+ yield* attributeIterator(definition, filterWritable);
71
73
  }
72
74
 
73
75
  export function prepareValue(value, attribute) {
package/src/multiple.mjs CHANGED
@@ -60,17 +60,18 @@ 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 {Object} filter
63
64
  * @return {Object} values
64
65
  */
65
- export function getAttributesJSON(object, definitions) {
66
+ export function getAttributesJSON(object, definitions, filter) {
66
67
  const result = {};
67
68
 
68
- for (const [path, def] of attributeIterator(definitions)) {
69
+ for (const [path, def] of attributeIterator(definitions, filter)) {
69
70
  const name = path.join(".");
70
71
 
71
72
  let value = getAttribute(object, name, def);
72
73
  if (value !== undefined) {
73
- if(value instanceof Set) {
74
+ if (value instanceof Set) {
74
75
  value = [...value];
75
76
  }
76
77
  setAttribute(result, def.externalName ?? name, value, def);
@@ -16,3 +16,4 @@ export function attributeIterator(definition: any, filter: Function, path?: stri
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 manadatoryAttributesPresent(object: any, attributes: any): boolean;
19
+ export function filterWritable(name: any, attribute: any): any;
@@ -17,6 +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 {Object} filter
20
21
  * @return {Object} values
21
22
  */
22
- export function getAttributesJSON(object: any, definitions: any): any;
23
+ export function getAttributesJSON(object: any, definitions: any, filter: any): any;