Comparing version 2.0.0 to 2.1.0-candidate
'use strict'; | ||
var stringWidth = require('string-width'); | ||
var stripAnsi = require('strip-ansi'); | ||
@@ -55,3 +56,3 @@ var ESCAPES = [ | ||
var insideEscape = false; | ||
var visible = rows[rows.length - 1].length; | ||
var visible = stripAnsi(rows[rows.length - 1]).length; | ||
@@ -126,2 +127,7 @@ for (var i = 0; i < word.length; i++) { | ||
if (rowLength + lengths[i] > cols && rowLength > 0) { | ||
if (options.wordWrap === false && rowLength < cols) { | ||
wrapWord(rows, word, cols); | ||
continue; | ||
} | ||
rows.push(''); | ||
@@ -128,0 +134,0 @@ } |
{ | ||
"name": "wrap-ansi", | ||
"version": "2.0.0", | ||
"version": "2.1.0-candidate", | ||
"description": "Wordwrap a string with ANSI escape codes", | ||
@@ -22,4 +22,4 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && nyc node test.js", | ||
"coverage": "nyc --reporter=text-lcov node test.js | coveralls" | ||
"test": "xo && nyc ava", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
@@ -57,10 +57,11 @@ "files": [ | ||
"dependencies": { | ||
"string-width": "^1.0.1" | ||
"string-width": "^1.0.1", | ||
"strip-ansi": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "0.0.4", | ||
"ava": "*", | ||
"chalk": "^1.1.0", | ||
"coveralls": "^2.11.4", | ||
"has-ansi": "^2.0.0", | ||
"nyc": "^3.2.2", | ||
"nyc": "^6.2.1", | ||
"strip-ansi": "^3.0.0", | ||
@@ -67,0 +68,0 @@ "xo": "*" |
@@ -1,2 +0,2 @@ | ||
# 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/chalk/wrap-ansi/badge.svg?branch=master&service=github)](https://coveralls.io/github/chalk/wrap-ansi?branch=master) | ||
# 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) | ||
@@ -46,5 +46,7 @@ > Wordwrap a string with [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) | ||
#### options.hard | ||
#### options | ||
Type: `boolean` | ||
##### hard | ||
Type: `boolean`<br> | ||
Default: `false` | ||
@@ -54,6 +56,14 @@ | ||
##### wordWrap | ||
Type: `boolean`<br> | ||
Default: `true` | ||
By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary. | ||
## Related | ||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes | ||
- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal | ||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right | ||
@@ -65,2 +75,2 @@ - [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures. | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
7790
139
74
0
2
2
+ Addedstrip-ansi@^3.0.1