| 12 | import path from 'path'; |
| 13 | |
| 14 | function count(search: string, string: string): number { |
| 15 | // Count starts at -1 because a do-while loop always runs at least once |
| 16 | let count = -1, |
| 17 | index = -1; |
| 18 | do { |
| 19 | // First call or the while case evaluated true, meaning we have to make |
| 20 | // count 0 or we found a character |
| 21 | ++count; |
| 22 | // Find the index of our search string, starting after the previous index |
| 23 | index = string.indexOf(search, index + 1); |
| 24 | } while (index !== -1); |
| 25 | return count; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Turns a set of mapped <code>StackFrame</code>s back into their generated code position and enhances them with code. |