UNPKG

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