(text, addition)
| 189 | return finalFileName |
| 190 | } |
| 191 | function addLineAfterLastOccurrence(text, addition) { |
| 192 | const regex = /^#!.+?$/gm |
| 193 | const matchArray = text.match(regex) |
| 194 | const lastIndex = matchArray ? matchArray.length - 1 : -1 |
| 195 | |
| 196 | if (lastIndex >= 0) { |
| 197 | const lastMatch = matchArray[lastIndex] |
| 198 | const insertIndex = text.indexOf(lastMatch) + lastMatch.length |
| 199 | const newText = text.slice(0, insertIndex) + addition + text.slice(insertIndex) |
| 200 | return newText |
| 201 | } |
| 202 | |
| 203 | return text |
| 204 | } |
| 205 | |
| 206 | function delay(ms) { |
| 207 | return new Promise(resolve => setTimeout(resolve, ms)) |
no outgoing calls
no test coverage detected