(pattern: string, text: string)
| 156 | } |
| 157 | |
| 158 | function getIndicesOf(pattern: string, text: string) { |
| 159 | let startIndex = 0; |
| 160 | let index: number; |
| 161 | let indices = []; |
| 162 | |
| 163 | while ((index = text.indexOf(pattern, startIndex)) > -1) { |
| 164 | indices.push(index); |
| 165 | startIndex = index + 1; |
| 166 | } |
| 167 | |
| 168 | return indices; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Replaces _actual newline_ in the pattern with escaped newline. |