【文件属性】:
文件名称:cli-truncate:在终端中将字符串截断为特定宽度
文件大小:8KB
文件格式:ZIP
更新时间:2021-05-26 07:54:38
JavaScript
气候截断
在终端中将字符串截断为特定宽度
优雅地处理。 像用造型的弦子。 它还支持Unicode代理对和全角字符。
安装
$ npm install cli-truncate
用法
const cliTruncate = require ( 'cli-truncate' ) ;
cliTruncate ( 'unicorn' , 4 ) ;
//=> 'uni…'
// Truncate at different positions
cliTruncate ( 'unicorn' , 4 , { position : 'start' } ) ;
//=> '…orn'
cliTruncate ( 'unicorn' , 4 , { position : 'middle' } ) ;
//=> 'un…n'
cliTruncate ( 'unicorns rainbow dragons'
【文件预览】:
cli-truncate-main
----index.test-d.ts(415B)
----.gitattributes(19B)
----.github()
--------funding.yml(118B)
--------security.md(179B)
--------workflows()
----test.js(3KB)
----license(1KB)
----index.d.ts(2KB)
----.npmrc(19B)
----.editorconfig(175B)
----.gitignore(23B)
----index.js(2KB)
----readme.md(3KB)
----package.json(790B)