(s: string, replaceAllWith?)
| 71 | // replace ${xxx} format in s with every possible value of the variable |
| 72 | // if s doesn't contain any variable, return [s] |
| 73 | export const replaceWithVariablesHasMultiValues = (s: string, replaceAllWith?): string[] => { |
| 74 | const vars = $variables.get() |
| 75 | let res = [] |
| 76 | const formats = parseVariableFormat(s); |
| 77 | for (const f of formats) { |
| 78 | const v = (vars.length > 0 ? vars : gvariables).find(v => v.name ==f) |
| 79 | if (v) { |
| 80 | |
| 81 | let selected = [] |
| 82 | if (v.selected == VarialbeAllOption) { |
| 83 | if (replaceAllWith) { |
| 84 | selected.push(replaceAllWith) |
| 85 | } else { |
| 86 | selected = v.values?.filter(v1 => v1 != VarialbeAllOption )??[] |
| 87 | } |
| 88 | } else { |
| 89 | selected = isEmpty(v.selected) ? [] : v.selected.split(VariableSplitChar) |
| 90 | } |
| 91 | |
| 92 | |
| 93 | res = selected.map(v => s.replaceAll(`\${${f}}`, v)) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | if (res.length == 0) { |
| 98 | res.push(s) |
| 99 | } |
| 100 | |
| 101 | // console.log("here333333:",s, res) |
| 102 | |
| 103 | return res |
| 104 | } |
| 105 | |
| 106 |
no test coverage detected