pacc 8.6.1 → 8.6.2
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/expand.mjs +1 -40
package/package.json
CHANGED
package/src/expand.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parse } from "./expression.mjs";
|
|
2
2
|
|
|
3
|
-
const maxNestingLevel =
|
|
3
|
+
const maxNestingLevel = 8;
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Expand expressions inside of object graphs.
|
|
@@ -70,45 +70,6 @@ export function expand(object, context = {}) {
|
|
|
70
70
|
result += object.substring(cur);
|
|
71
71
|
|
|
72
72
|
return result;
|
|
73
|
-
/*
|
|
74
|
-
const v = object.replace(
|
|
75
|
-
/\$\{([^\}]*)\}/g,
|
|
76
|
-
(match, expression, offset, string) => {
|
|
77
|
-
let value = parse(expression, context);
|
|
78
|
-
|
|
79
|
-
if (typeof value === "string" || value instanceof String) {
|
|
80
|
-
value = _expand(value, path);
|
|
81
|
-
} else if (value === undefined) {
|
|
82
|
-
value = leadIn + expression + leadOut;
|
|
83
|
-
}
|
|
84
|
-
if (
|
|
85
|
-
string.length ===
|
|
86
|
-
expression.length + leadIn.length + leadOut.length
|
|
87
|
-
) {
|
|
88
|
-
wholeValue = value;
|
|
89
|
-
return "";
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (value instanceof Promise) {
|
|
93
|
-
localPromises.push(value);
|
|
94
|
-
return leadIn + (localPromises.length - 1) + leadOut;
|
|
95
|
-
}
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
if (wholeValue !== undefined) {
|
|
101
|
-
return wholeValue;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (localPromises.length !== 0) {
|
|
105
|
-
return Promise.all(localPromises).then(all =>
|
|
106
|
-
v.replace(/\$\{(\d+)\}/g, (match, key) => all[parseInt(key, 10)])
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return v;
|
|
111
|
-
*/
|
|
112
73
|
}
|
|
113
74
|
|
|
114
75
|
switch (typeof object) {
|