(data, index)
| 13 | // limitations under the License. |
| 14 | |
| 15 | const getLineNumberOfIndex = (data, index) => { |
| 16 | const lines = data.split('\n') |
| 17 | let line = 0 |
| 18 | let i = 0 |
| 19 | |
| 20 | while (i < index) { |
| 21 | i += lines[line].length + 1 |
| 22 | line++ |
| 23 | } |
| 24 | |
| 25 | return line |
| 26 | } |
| 27 | |
| 28 | const insertAtLineAtIndex = (oldContents, index, content) => { |
| 29 | const line = getLineNumberOfIndex(oldContents, index) |
no test coverage detected