Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
index.js | D | 12-May-2024 | 191 | 9 | 7 | |
license | D | 12-May-2024 | 1.1 KiB | 10 | 5 | |
package.json | D | 12-May-2024 | 1.9 KiB | 87 | 86 | |
readme.md | D | 12-May-2024 | 914 | 35 | 18 |
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