UNPKG

547 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.errtermwidth = exports.stdtermwidth = void 0;
4function termwidth(stream) {
5 if (!stream.isTTY || !stream.getWindowSize) {
6 return 80;
7 }
8 const width = stream.getWindowSize()[0];
9 if (width < 1) {
10 return 80;
11 }
12 if (width < 40) {
13 return 40;
14 }
15 return width;
16}
17const columns = global.columns;
18exports.stdtermwidth = columns || termwidth(process.stdout);
19exports.errtermwidth = columns || termwidth(process.stderr);