MCPcopy Index your code
hub / github.com/nodejs/node / getSingleCommandLines

Function getSingleCommandLines

test/parallel/test-repl-custom-eval-previews.js:71–92  ·  view source on GitHub ↗
(output)

Source from the content-addressed store, hash-verified

69});
70
71function getSingleCommandLines(output) {
72 const outputLines = output.split('\n');
73
74 // The first line contains the command being run
75 const command = outputLines.shift();
76
77 // The last line contains the prompt (asking for some new input)
78 const prompt = outputLines.pop();
79
80 // The line before the last one contains the result of the command
81 const result = outputLines.pop();
82
83 // The line before that contains the preview of the command
84 const preview = outputLines.shift();
85
86 return {
87 command,
88 prompt,
89 result,
90 preview,
91 };
92}

Calls 3

popMethod · 0.80
splitMethod · 0.45
shiftMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…