• Home
Name Date Size #Lines LOC

..--

index.jsD12-May-2024191 97

licenseD12-May-20241.1 KiB105

package.jsonD12-May-20241.9 KiB8786

readme.mdD12-May-2024914 3518

readme.md

1# widest-line [![Build Status](https://travis-ci.org/sindresorhus/widest-line.svg?branch=master)](https://travis-ci.org/sindresorhus/widest-line)
2
3> Get the visual width of the widest line in a string - the number of columns required to display it
4
5Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
6
7Useful to be able to know the maximum width a string will take up in the terminal.
8
9
10## Install
11
12```
13$ npm install widest-line
14```
15
16
17## Usage
18
19```js
20const widestLine = require('widest-line');
21
22widestLine('古\n\u001B[1m@\u001B[22m');
23//=> 2
24```
25
26
27## Related
28
29- [string-width](https://github.com/sindresorhus/string-width) - Get the visual width of a string
30
31
32## License
33
34MIT © [Sindre Sorhus](https://sindresorhus.com)
35