Socket
Socket
Sign inDemoInstall

wrap-ansi

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wrap-ansi - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0-candidate

8

index.js
'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 @@ }

13

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc