(module, code)
| 228 | * @returns {string} generated code for the stack |
| 229 | */ |
| 230 | const printGeneratedCodeForStack = (module, code) => { |
| 231 | const lines = code.split("\n"); |
| 232 | const n = `${lines.length}`.length; |
| 233 | return `\n\nGenerated code for ${module.identifier()}\n${lines |
| 234 | .map( |
| 235 | /** |
| 236 | * Handles the callback logic for this hook. |
| 237 | * @param {string} line the line |
| 238 | * @param {number} i the index |
| 239 | * @param {string[]} _lines the lines |
| 240 | * @returns {string} the line with line number |
| 241 | */ |
| 242 | (line, i, _lines) => { |
| 243 | const iStr = `${i + 1}`; |
| 244 | return `${" ".repeat(n - iStr.length)}${iStr} | ${line}`; |
| 245 | } |
| 246 | ) |
| 247 | .join("\n")}`; |
| 248 | }; |
| 249 | |
| 250 | /** |
| 251 | * Defines the render context type used by this module. |
no test coverage detected