@lotics/app-sdk 0.123.10 → 0.123.11
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 +22 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12650,27 +12650,33 @@ function innermostLists(value) {
|
|
|
12650
12650
|
}
|
|
12651
12651
|
|
|
12652
12652
|
// ../shared/src/interpolate.ts
|
|
12653
|
+
function findInterpolations(text2) {
|
|
12654
|
+
return [...text2.matchAll(/\{\{.*?\}\}/g)].map((match2) => ({
|
|
12655
|
+
start: match2.index,
|
|
12656
|
+
end: match2.index + match2[0].length,
|
|
12657
|
+
source: match2[0],
|
|
12658
|
+
expression: match2[0].slice(2, -2).trim()
|
|
12659
|
+
}));
|
|
12660
|
+
}
|
|
12653
12661
|
function interpolateObject(obj, context) {
|
|
12654
12662
|
if (obj === null || obj === void 0) {
|
|
12655
12663
|
return obj;
|
|
12656
12664
|
}
|
|
12657
12665
|
if (typeof obj === "string") {
|
|
12658
|
-
const
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
12662
|
-
return evaluateJsExpression(expression, context);
|
|
12663
|
-
}
|
|
12664
|
-
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
});
|
|
12673
|
-
return evaluatedParts.join("");
|
|
12666
|
+
const interpolations = findInterpolations(obj);
|
|
12667
|
+
const [only] = interpolations;
|
|
12668
|
+
if (only) {
|
|
12669
|
+
if (interpolations.length === 1 && obj === only.source) {
|
|
12670
|
+
return evaluateJsExpression(only.expression, context);
|
|
12671
|
+
}
|
|
12672
|
+
let out = "";
|
|
12673
|
+
let cursor = 0;
|
|
12674
|
+
for (const interpolation of interpolations) {
|
|
12675
|
+
const result = evaluateJsExpression(interpolation.expression, context);
|
|
12676
|
+
out += obj.slice(cursor, interpolation.start) + (result != null ? String(result) : "");
|
|
12677
|
+
cursor = interpolation.end;
|
|
12678
|
+
}
|
|
12679
|
+
return out + obj.slice(cursor);
|
|
12674
12680
|
}
|
|
12675
12681
|
return obj;
|
|
12676
12682
|
}
|
package/package.json
CHANGED