pacc 3.6.6 → 3.6.7
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 +1 -0
- package/package.json +1 -1
- package/src/multiple.mjs +7 -4
package/README.md
CHANGED
|
@@ -186,6 +186,7 @@ Copies attribute values from a source object into a destination object.
|
|
|
186
186
|
* `source` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** origin of the data to be copied
|
|
187
187
|
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** attribute definitions to be used
|
|
188
188
|
* `cb` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** callback to be executed for each copied value
|
|
189
|
+
* `prefix` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name parefix
|
|
189
190
|
|
|
190
191
|
## getAttributes
|
|
191
192
|
|
package/package.json
CHANGED
package/src/multiple.mjs
CHANGED
|
@@ -73,16 +73,19 @@ export function mergeAttributeDefinitions(dest, atts) {
|
|
|
73
73
|
*/
|
|
74
74
|
export function setAttributes(object, source, definitions, cb, prefix) {
|
|
75
75
|
for (let [name, def] of Object.entries(definitions)) {
|
|
76
|
-
if(prefix !== undefined) {
|
|
76
|
+
if (prefix !== undefined) {
|
|
77
77
|
name = prefix + name;
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
if (def.attributes) {
|
|
81
|
+
setAttributes(object, source, def.attributes, cb, name + ".");
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
let value = getAttribute(source, name);
|
|
80
86
|
|
|
81
87
|
if (value === undefined) {
|
|
82
88
|
if (def.default === undefined) {
|
|
83
|
-
if (def.attributes) {
|
|
84
|
-
setAttributes(object, source, def.attributes, cb, name + ".");
|
|
85
|
-
}
|
|
86
89
|
continue;
|
|
87
90
|
} else {
|
|
88
91
|
if (getAttribute(object, name) !== undefined) {
|