UNPKG

lib-curses

Version:

Simple node.js library for work with console

16 lines (15 loc) 477 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.position = position; /** * Moves terminal cursor to a specified position (x, y). * * @param {number} [x=-1] - Horizontal position (column). Default is no action. * @param {number} [y=-1] - Vertical position (row). Default is no action. * @returns {void} */ function position(x = -1, y = -1) { if (x >= 0 || y >= 0) { process.stdout.write(`\x1b[${y + 1};${x + 1}H`); } }