(str)
| 174 | }) |
| 175 | } |
| 176 | function convertToValidFileName(str) { |
| 177 | // 替换非法字符为下划线 |
| 178 | const invalidCharsRegex = /[\/:*?"<>|]/g |
| 179 | const validFileName = str.replace(invalidCharsRegex, '_') |
| 180 | |
| 181 | // 删除多余的点号 |
| 182 | const multipleDotsRegex = /\.{2,}/g |
| 183 | const fileNameWithoutMultipleDots = validFileName.replace(multipleDotsRegex, '.') |
| 184 | |
| 185 | // 删除文件名开头和结尾的点号和空格 |
| 186 | const leadingTrailingDotsSpacesRegex = /^[\s.]+|[\s.]+$/g |
| 187 | const finalFileName = fileNameWithoutMultipleDots.replace(leadingTrailingDotsSpacesRegex, '') |
| 188 | |
| 189 | return finalFileName |
| 190 | } |
| 191 | function addLineAfterLastOccurrence(text, addition) { |
| 192 | const regex = /^#!.+?$/gm |
| 193 | const matchArray = text.match(regex) |
nothing calls this directly
no outgoing calls
no test coverage detected