MCPcopy
hub / github.com/TypeStrong/ts-node / appendToEvalState

Function appendToEvalState

src/repl.ts:682–698  ·  view source on GitHub ↗

* Append to the eval instance and return an undo function.

(state: EvalState, input: string)

Source from the content-addressed store, hash-verified

680 * Append to the eval instance and return an undo function.
681 */
682function appendToEvalState(state: EvalState, input: string) {
683 const undoInput = state.input;
684 const undoVersion = state.version;
685 const undoOutput = state.output;
686 const undoLines = state.lines;
687
688 state.input += input;
689 state.lines += lineCount(input);
690 state.version++;
691
692 return function () {
693 state.input = undoInput;
694 state.output = undoOutput;
695 state.version = undoVersion;
696 state.lines = undoLines;
697 };
698}
699
700/**
701 * Count the number of lines.

Callers 2

startInternalFunction · 0.85

Calls 1

lineCountFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…