cli-width
Advanced tools
Comparing version 2.2.1 to 3.0.0
@@ -5,2 +5,14 @@ # Changelog | ||
## [3.0.0](https://github.com/knownasilya/cli-width/compare/v2.2.1...v3.0.0) (2020-04-14) | ||
### ⚠ BREAKING CHANGES | ||
* Dropped support for node < 10 | ||
* Dropped support for IOjs | ||
### Bug Fixes | ||
* drop node < 10 ([e42f6a7](https://github.com/knownasilya/cli-width/commit/e42f6a756ea47f85f736e6de2d7364d4d60a7dfe)) | ||
### [2.2.1](https://github.com/knownasilya/cli-width/compare/v2.2.0...v2.2.1) (2020-04-14) | ||
@@ -7,0 +19,0 @@ |
12
index.js
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,6 +6,6 @@ exports = module.exports = cliWidth; | ||
function normalizeOpts(options) { | ||
var defaultOpts = { | ||
let defaultOpts = { | ||
defaultWidth: 0, | ||
output: process.stdout, | ||
tty: require('tty') | ||
tty: require("tty"), | ||
}; | ||
@@ -27,3 +27,3 @@ | ||
function cliWidth(options) { | ||
var opts = normalizeOpts(options); | ||
let opts = normalizeOpts(options); | ||
@@ -43,3 +43,3 @@ if (opts.output.getWindowSize) { | ||
if (process.env.CLI_WIDTH) { | ||
var width = parseInt(process.env.CLI_WIDTH, 10); | ||
let width = parseInt(process.env.CLI_WIDTH, 10); | ||
@@ -52,2 +52,2 @@ if (!isNaN(width) && width !== 0) { | ||
return opts.defaultWidth; | ||
}; | ||
} |
{ | ||
"name": "cli-width", | ||
"version": "2.2.1", | ||
"version": "3.0.0", | ||
"description": "Get stdout window width, with two fallbacks, tty and then a default.", | ||
@@ -22,2 +22,5 @@ "main": "index.js", | ||
"homepage": "https://github.com/knownasilya/cli-width", | ||
"engines": { | ||
"node": ">= 10" | ||
}, | ||
"devDependencies": { | ||
@@ -24,0 +27,0 @@ "coveralls": "^3.0.11", |
@@ -1,3 +0,2 @@ | ||
cli-width | ||
========= | ||
# cli-width | ||
@@ -10,2 +9,4 @@ Get stdout window width, with four fallbacks, `tty`, `output.columns`, a custom environment variable and then a default. | ||
Tested against NodeJS v10+ | ||
## Usage | ||
@@ -18,5 +19,5 @@ | ||
```js | ||
'use strict'; | ||
"use strict"; | ||
var cliWidth = require('cli-width'); | ||
const cliWidth = require("cli-width"); | ||
@@ -41,3 +42,2 @@ cliWidth(); // maybe 204 :) | ||
### Examples | ||
@@ -48,8 +48,8 @@ | ||
```js | ||
var cliWidth = require('cli-width'); | ||
var ttys = require('ttys'); | ||
const cliWidth = require("cli-width"); | ||
const ttys = require("ttys"); | ||
cliWidth({ | ||
defaultWidth: 80, | ||
output: ttys.output | ||
output: ttys.output, | ||
}); | ||
@@ -61,7 +61,7 @@ ``` | ||
```js | ||
var cliWidth = require('cli-width'); | ||
var ttys = require('ttys'); | ||
const cliWidth = require("cli-width"); | ||
const ttys = require("ttys"); | ||
cliWidth({ | ||
tty: ttys | ||
tty: ttys, | ||
}); | ||
@@ -68,0 +68,0 @@ ``` |
Sorry, the diff of this file is not supported yet
11494