Socket
Socket
Sign inDemoInstall

cli-truncate

Package Overview
Dependencies
5
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

80

package.json
{
"name": "cli-truncate",
"version": "1.0.0",
"description": "Truncate a string to a specific width in the terminal",
"license": "MIT",
"repository": "sindresorhus/cli-truncate",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"truncate",
"ellipsis",
"text",
"limit",
"slice",
"cli",
"terminal",
"term",
"shell",
"width",
"ansi"
],
"dependencies": {
"slice-ansi": "0.0.4",
"string-width": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "cli-truncate",
"version": "1.1.0",
"description": "Truncate a string to a specific width in the terminal",
"license": "MIT",
"repository": "sindresorhus/cli-truncate",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"truncate",
"ellipsis",
"text",
"limit",
"slice",
"cli",
"terminal",
"term",
"shell",
"width",
"ansi"
],
"dependencies": {
"slice-ansi": "^1.0.0",
"string-width": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
}

@@ -5,3 +5,3 @@ # cli-truncate [![Build Status](https://travis-ci.org/sindresorhus/cli-truncate.svg?branch=master)](https://travis-ci.org/sindresorhus/cli-truncate)

Gracefully handles [ANSI escapes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles). Like a string styled with [`chalk`](https://github.com/chalk/chalk).
Gracefully handles [ANSI escapes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles). Like a string styled with [`chalk`](https://github.com/chalk/chalk). It also supports Unicode surrogate pairs and fullwidth characters.

@@ -12,3 +12,3 @@

```
$ npm install --save cli-truncate
$ npm install cli-truncate
```

@@ -32,5 +32,13 @@

cliTruncate('\u001b[31municorn\u001b[39m', 4);
//=> '\u001b[31muni\u001b[39m…'
cliTruncate('\u001B[31municorn\u001B[39m', 4);
//=> '\u001B[31muni\u001B[39m…'
// Truncate Unicode surrogate pairs
cliTruncate('uni\uD83C\uDE00corn', 5);
//=> 'uni\uD83C\uDE00…'
// Truncate fullwidth characters
cliTruncate('안녕하세요', 3);
//=> '안…'
// Truncate the paragraph to the terminal width

@@ -66,4 +74,4 @@ const paragraph = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.';

Type: `string`<br>
Default: `'end'`<br>
Values: `'start'`, `'middle'`, `'end'`
Default: `end`<br>
Values: `start` `middle` `end`

@@ -70,0 +78,0 @@ Position to truncate the string.

Sorry, the diff of this file is not supported yet

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