(position, replace, replaceWith, code)
| 140 | * @return {string} |
| 141 | */ |
| 142 | export function replaceAtPosition(position, replace, replaceWith, code) { |
| 143 | const subString = code.substr(position); |
| 144 | |
| 145 | // This is needed to fix an issue where $ signs do not render in the |
| 146 | // highlighted code |
| 147 | // |
| 148 | // @see https://github.com/ccampbell/rainbow/issues/208 |
| 149 | replaceWith = replaceWith.replace(/\$/g, '$$$$'); |
| 150 | |
| 151 | return code.substr(0, position) + subString.replace(replace, replaceWith); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * Creates a usable web worker from an anonymous function |
no outgoing calls
no test coverage detected