pacc 4.34.3 → 4.35.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 +1 -1
- package/src/multiple.mjs +4 -3
- package/types/multiple.d.mts +2 -1
package/package.json
CHANGED
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);
|
package/types/multiple.d.mts
CHANGED
|
@@ -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;
|