MCPcopy
hub / github.com/vercel/hyper / cliWidth

Function cliWidth

bin/yarn-standalone.js:109485–109509  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

109483}
109484
109485function cliWidth(options) {
109486 var opts = normalizeOpts(options);
109487
109488 if (opts.output.getWindowSize) {
109489 return opts.output.getWindowSize()[0] || opts.defaultWidth;
109490 } else {
109491 if (opts.tty.getWindowSize) {
109492 return opts.tty.getWindowSize()[1] || opts.defaultWidth;
109493 } else {
109494 if (opts.output.columns) {
109495 return opts.output.columns;
109496 } else {
109497 if (process.env.CLI_WIDTH) {
109498 var width = parseInt(process.env.CLI_WIDTH, 10);
109499
109500 if (!isNaN(width) && width !== 0) {
109501 return width;
109502 }
109503 }
109504 }
109505
109506 return opts.defaultWidth;
109507 }
109508 }
109509};
109510
109511
109512/***/ }),

Callers 1

normalizedCliWidthMethod · 0.85

Calls 3

normalizeOptsFunction · 0.85
parseIntFunction · 0.85
isNaNFunction · 0.85

Tested by

no test coverage detected