moves the cursor to the x and y coordinate on the given stream
function cursorTo(stream, x, y) {
  if (stream === null || stream === undefined)
    return;

  if (typeof x !== 'number' && typeof y !== 'number')
    return;

  if (typeof x !== 'number')
    throw new Error('ERR_INVALID_CURSOR_POS');

  if (typeof y !== 'number') {
    stream.write(CSI`${x + 1}G`);
  } else {
    stream.write(CSI`${y + 1};${x + 1}H`);
  }
}