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

Function clearLine

lib/internal/readline/callbacks.js:95–108  ·  view source on GitHub ↗

* clears the current line the cursor is on: * -1 for left of the cursor * +1 for right of the cursor * 0 for the entire line

(stream, dir, callback)

Source from the content-addressed store, hash-verified

93 */
94
95function clearLine(stream, dir, callback) {
96 if (callback !== undefined) {
97 validateFunction(callback, 'callback');
98 }
99
100 if (stream === null || stream === undefined) {
101 if (typeof callback === 'function') process.nextTick(callback, null);
102 return true;
103 }
104
105 const type =
106 dir < 0 ? kClearToLineBeginning : dir > 0 ? kClearToLineEnd : kClearLine;
107 return stream.write(type, callback);
108}
109
110/**
111 * clears the screen from the current position of the cursor down

Callers 1

clearPreviewFunction · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…