Socket
Socket
Sign inDemoInstall

wrap-ansi

Package Overview
Dependencies
6
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0 to 8.0.0

20

index.js

@@ -1,5 +0,4 @@

'use strict';
const stringWidth = require('string-width');
const stripAnsi = require('strip-ansi');
const ansiStyles = require('ansi-styles');
import stringWidth from 'string-width';
import stripAnsi from 'strip-ansi';
import ansiStyles from 'ansi-styles';

@@ -12,3 +11,2 @@ const ESCAPES = new Set([

const END_CODE = 39;
const ANSI_ESCAPE_BELL = '\u0007';

@@ -20,3 +18,3 @@ const ANSI_CSI = '[';

const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
const wrapAnsiCode = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;

@@ -168,3 +166,3 @@

if (options.trim !== false) {
rows = rows.map(stringVisibleTrimSpacesRight);
rows = rows.map(row => stringVisibleTrimSpacesRight(row));
}

@@ -195,7 +193,7 @@

if (escapeCode && code) {
returnValue += wrapAnsi(code);
returnValue += wrapAnsiCode(code);
}
} else if (character === '\n') {
if (escapeCode && code) {
returnValue += wrapAnsi(escapeCode);
returnValue += wrapAnsiCode(escapeCode);
}

@@ -213,3 +211,3 @@

// For each newline, invoke the method separately
module.exports = (string, columns, options) => {
export default function wrapAnsi(string, columns, options) {
return String(string)

@@ -221,2 +219,2 @@ .normalize()

.join('\n');
};
}
{
"name": "wrap-ansi",
"version": "7.0.0",
"version": "8.0.0",
"description": "Wordwrap a string with ANSI escape codes",

@@ -13,4 +13,6 @@ "license": "MIT",

},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=10"
"node": ">=12"
},

@@ -51,14 +53,14 @@ "scripts": {

"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
"ansi-styles": "^6.0.0",
"string-width": "^5.0.0",
"strip-ansi": "^7.0.0"
},
"devDependencies": {
"ava": "^2.1.0",
"chalk": "^4.0.0",
"coveralls": "^3.0.3",
"has-ansi": "^4.0.0",
"nyc": "^15.0.1",
"xo": "^0.29.1"
"ava": "^3.15.0",
"chalk": "^4.1.0",
"coveralls": "^3.1.0",
"has-ansi": "^5.0.0",
"nyc": "^15.1.0",
"xo": "^0.38.2"
}
}

@@ -1,2 +0,2 @@

# wrap-ansi [![Build Status](https://travis-ci.com/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.com/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)
# wrap-ansi

@@ -14,4 +14,4 @@ > Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)

```js
const chalk = require('chalk');
const wrapAnsi = require('wrap-ansi');
import chalk from 'chalk';
import wrapAnsi from 'wrap-ansi';

@@ -18,0 +18,0 @@ const input = 'The quick brown ' + chalk.red('fox jumped over ') +

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc