(str: string, type: string, change: string)
| 872 | } |
| 873 | |
| 874 | function buildNewConfigArray(str: string, type: string, change: string) { |
| 875 | const newStr = str |
| 876 | .split(`${type}s: `)[1] |
| 877 | .replace(/'/g, '') |
| 878 | |
| 879 | const newArray = newStr.match(/(\w*)/gmi)?.filter(e => !!e).concat([change]) || [] |
| 880 | |
| 881 | return str |
| 882 | .replace('// ', '') |
| 883 | .replace( |
| 884 | new RegExp(`(${type}s: )((.*\\s*)*)`), `$1[${newArray.map(e => `'${e}'`)}]` |
| 885 | ) |
| 886 | } |
| 887 | |
| 888 | function buildNewConfigString(str: string, type: string, change: string) { |
| 889 | return str.replace(new RegExp(`(${type}: )('\\w*')`), `$1'${change}'`) |
no outgoing calls
no test coverage detected
searching dependent graphs…