@kontur.candy/generator 5.9.0 → 5.10.0-fs-7919-templates.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/dist/index.js +34 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71900,6 +71900,8 @@ class EvaluateTemplateVisitor {
|
|
|
71900
71900
|
node.attributes[attributeName] = updatedValue;
|
|
71901
71901
|
} else if (typeof attribute === "object" && !Array.isArray(attribute) && attribute !== null) {
|
|
71902
71902
|
node.attributes[attributeName] = this.parseObjectAttribute(attribute, stringParameters);
|
|
71903
|
+
} else if (typeof attribute === "object" && Array.isArray(attribute) && attribute !== null) {
|
|
71904
|
+
node.attributes[attributeName] = this.parseArrayAttribute(attribute, stringParameters);
|
|
71903
71905
|
}
|
|
71904
71906
|
}
|
|
71905
71907
|
if (node.name === "#innertext") {
|
|
@@ -71979,9 +71981,40 @@ class EvaluateTemplateVisitor {
|
|
|
71979
71981
|
result[key] = updatedValue;
|
|
71980
71982
|
} else if (typeof value === "number") {
|
|
71981
71983
|
result[key] = value;
|
|
71982
|
-
} else if (typeof value === "object") {
|
|
71984
|
+
} else if (typeof value === "object" && !Array.isArray(value)) {
|
|
71983
71985
|
const typedValue = value;
|
|
71984
71986
|
result[key] = this.parseObjectAttribute(typedValue, stringParameters);
|
|
71987
|
+
} else if (typeof value === "object" && Array.isArray(value)) {
|
|
71988
|
+
const typedValue = value;
|
|
71989
|
+
result[key] = this.parseArrayAttribute(typedValue, stringParameters);
|
|
71990
|
+
}
|
|
71991
|
+
}
|
|
71992
|
+
return result;
|
|
71993
|
+
}
|
|
71994
|
+
parseArrayAttribute(attribute, stringParameters) {
|
|
71995
|
+
const result = [];
|
|
71996
|
+
if (attribute === undefined) {
|
|
71997
|
+
return result;
|
|
71998
|
+
}
|
|
71999
|
+
for (const [, value] of Object.entries(attribute)) {
|
|
72000
|
+
if (typeof value === "string") {
|
|
72001
|
+
let updatedValue = value;
|
|
72002
|
+
for (const parameter of stringParameters) {
|
|
72003
|
+
updatedValue = this.applyStringParameter(parameter, updatedValue);
|
|
72004
|
+
}
|
|
72005
|
+
if (typeof updatedValue === "string") {
|
|
72006
|
+
result.push(updatedValue);
|
|
72007
|
+
} else {
|
|
72008
|
+
throw new Error("Parameter type should be String");
|
|
72009
|
+
}
|
|
72010
|
+
} else if (typeof value === "number") {
|
|
72011
|
+
result.push(value);
|
|
72012
|
+
} else if (typeof value === "object" && !Array.isArray(value)) {
|
|
72013
|
+
const typedValue = value;
|
|
72014
|
+
result.push(this.parseObjectAttribute(typedValue, stringParameters));
|
|
72015
|
+
} else if (typeof value === "object" && Array.isArray(value)) {
|
|
72016
|
+
const typedValue = value;
|
|
72017
|
+
result.push(this.parseArrayAttribute(typedValue, stringParameters));
|
|
71985
72018
|
}
|
|
71986
72019
|
}
|
|
71987
72020
|
return result;
|