Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function clearScreen() {
const blank = '\n'.repeat(process.stdout.rows);
console.log(blank);
readline.cursorTo(process.stdout, 0, 0);
readline.clearScreenDown(process.stdout);
}
export function render(str: string) {
if (lines) {
readline.moveCursor(stdout, 0, -lines)
readline.clearScreenDown(stdout)
}
lines = (str.match(/\n/g) || []).length
stdout.write(str)
}