* @param {string} content * @param {string} startMarker * @param {string} endMarker * @param {string[]} generatedLines * @returns {Promise }
(content, startMarker, endMarker, generatedLines)
| 103 | * @returns {Promise<string>} |
| 104 | */ |
| 105 | async function updateSection(content, startMarker, endMarker, generatedLines) { |
| 106 | const startMarkerIndex = content.indexOf(startMarker); |
| 107 | const endMarkerIndex = content.indexOf(endMarker); |
| 108 | if (startMarkerIndex === -1 || endMarkerIndex === -1) |
| 109 | throw new Error('Markers for generated section not found in README'); |
| 110 | |
| 111 | return [ |
| 112 | content.slice(0, startMarkerIndex + startMarker.length), |
| 113 | '', |
| 114 | generatedLines.join('\n'), |
| 115 | '', |
| 116 | content.slice(endMarkerIndex), |
| 117 | ].join('\n'); |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * @param {string} content |
no outgoing calls
no test coverage detected