wrap-ansi
Advanced tools
Comparing version 5.1.0 to 6.0.0
19
index.js
@@ -24,3 +24,3 @@ 'use strict'; | ||
let insideEscape = false; | ||
let isInsideEscape = false; | ||
let visible = stringWidth(stripAnsi(rows[rows.length - 1])); | ||
@@ -39,9 +39,9 @@ | ||
if (ESCAPES.has(character)) { | ||
insideEscape = true; | ||
} else if (insideEscape && character === 'm') { | ||
insideEscape = false; | ||
isInsideEscape = true; | ||
} else if (isInsideEscape && character === 'm') { | ||
isInsideEscape = false; | ||
continue; | ||
} | ||
if (insideEscape) { | ||
if (isInsideEscape) { | ||
continue; | ||
@@ -85,7 +85,5 @@ } | ||
// The wrap-ansi module can be invoked | ||
// in either 'hard' or 'soft' wrap mode | ||
// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode | ||
// | ||
// 'hard' will never allow a string to take up more | ||
// than columns characters | ||
// 'hard' will never allow a string to take up more than columns characters | ||
// | ||
@@ -125,4 +123,3 @@ // 'soft' allows long words to expand past the column length | ||
// In 'hard' wrap mode, the length of a line is | ||
// never allowed to extend past 'columns' | ||
// In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' | ||
if (options.hard && lengths[index] > columns) { | ||
@@ -129,0 +126,0 @@ const remainingColumns = (columns - rowLength); |
{ | ||
"name": "wrap-ansi", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"description": "Wordwrap a string with ANSI escape codes", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=8" | ||
}, | ||
@@ -50,14 +50,14 @@ "scripts": { | ||
"dependencies": { | ||
"ansi-styles": "^3.2.0", | ||
"string-width": "^3.0.0", | ||
"ansi-styles": "^4.0.0", | ||
"string-width": "^4.1.0", | ||
"strip-ansi": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.2.1", | ||
"ava": "^2.1.0", | ||
"chalk": "^2.4.2", | ||
"coveralls": "^3.0.3", | ||
"has-ansi": "^3.0.0", | ||
"nyc": "^13.3.0", | ||
"nyc": "^14.1.1", | ||
"xo": "^0.24.0" | ||
} | ||
} |
@@ -27,24 +27,10 @@ # wrap-ansi [![Build Status](https://travis-ci.org/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.org/chalk/wrap-ansi) [![Coverage Status](https://coveralls.io/repos/github/chalk/wrap-ansi/badge.svg?branch=master)](https://coveralls.io/github/chalk/wrap-ansi?branch=master) | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-wrap_ansi?utm_source=npm-wrap-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> | ||
--- | ||
## API | ||
### wrapAnsi(input, columns, [options]) | ||
### wrapAnsi(string, columns, options?) | ||
Wrap words to the specified column width. | ||
#### input | ||
#### string | ||
@@ -63,3 +49,3 @@ Type: `string` | ||
Type: `Object` | ||
Type: `object` | ||
@@ -103,9 +89,12 @@ ##### hard | ||
## Security | ||
--- | ||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. | ||
## License | ||
MIT | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-wrap_ansi?utm_source=npm-wrap-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
9427
146
98
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedemoji-regex@7.0.3(transitive)
- Removedis-fullwidth-code-point@2.0.0(transitive)
- Removedstring-width@3.1.0(transitive)
Updatedansi-styles@^4.0.0
Updatedstring-width@^4.1.0