【文件属性】:
文件名称:wrap-ansi:使用ANSI转义码对字符串进行自动换行
文件大小:20KB
文件格式:ZIP
更新时间:2021-04-29 11:35:34
JavaScript
包裹
使用对字符串进行自动换行
安装
$ npm install wrap-ansi
用法
import chalk from 'chalk' ;
import wrapAnsi from 'wrap-ansi' ;
const input = 'The quick brown ' + chalk . red ( 'fox jumped over ' ) +
'the lazy ' + chalk . green ( 'dog and then ran away with the unicorn.' ) ;
console . log ( wrapAnsi ( input , 20 ) ) ;
原料药
wrapAnsi(字符串,列,选项?)
将单词换行到指定的列宽。
细绳
类型: string
带有ANSI转义码的字符串。 像用 。 换行符将被标准化为\n 。
列
类型: numbe
【文件预览】:
wrap-ansi-main
----.gitignore(35B)
----.github()
--------security.md(179B)
--------workflows()
--------funding.yml(53B)
----screenshot.png(11KB)
----.gitattributes(19B)
----package.json(1KB)
----readme.md(2KB)
----index.js(6KB)
----test.js(9KB)
----.editorconfig(175B)
----license(1KB)
----.npmrc(19B)