MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / repairTerminalWrapping

Function repairTerminalWrapping

benchmarks/wester/extract.mjs:56–71  ·  view source on GitHub ↗
(lines)

Source from the content-addressed store, hash-verified

54}
55
56function repairTerminalWrapping(lines) {
57 const repaired = [];
58
59 for (let line of lines) {
60 line = line.replace(/^>\s{0,4}/, '');
61
62 if (repaired.length > 0 && repaired.at(-1).endsWith('\\')) {
63 repaired[repaired.length - 1] =
64 repaired.at(-1).slice(0, -1) + ' ' + line.trimStart();
65 } else if (line !== '' || repaired.at(-1) !== '') {
66 repaired.push(line);
67 }
68 }
69
70 return repaired;
71}
72
73function extractInputs(transcript, sourceUrl) {
74 const lines = transcript.replaceAll('\r\n', '\n').split('\n');

Callers 1

extractInputsFunction · 0.85

Calls 3

replaceMethod · 0.65
atMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected