push
github
48 of 55 branches covered (87.27%)
Branch coverage included in aggregate %.
66 of 68 new or added lines in 3 files covered. (97.06%)
2 existing lines in 1 file now uncovered.365 of 434 relevant lines covered (84.1%)
4.16 hits per line
|
|
1✔ |
|
/**
|
|
|
* Expands '{{exp}}' expressions. |
5✔ |
|
* @param {any} value |
5✔ |
|
* @param {Object} params |
5✔ |
|
* @return {any} expanded value |
5✔ |
|
*/ |
5✔ |
|
export function expand(value, params) {
|
|
|
|
11✔ |
|
if (Array.isArray(value)) {
|
|
|
return value.map(e => expand(e, params));
|
|
|
} |
1✔ |
|
|
|
|
if(value === undefined || value == null || typeof value === "number") { |
|
NEW
|
return value;
|
× |
NEW
|
} |
× |
|
|
|
|
if (typeof value === "string") { |
|
|
return value.replace(/\{\{(\w+)\}\}/, (match, g1) => |
|
|
params[g1] ? params[g1] : g1 |
|
|
); |
8✔ |
|
} |
8✔ |
|
|
|
|
return Object.fromEntries(
|
2✔ |
|
Object.entries(value).map(([k, v]) => [ |
|
|
expand(k, params), |
4✔ |
|
expand(v, params) |
4✔ |
|
]) |
2✔ |
|
); |
2✔ |
|
} |
11✔ |