You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 914B

4 vuotta sitten
12345678910111213141516171819202122232425262728293031323334
  1. # widest-line [![Build Status](https://travis-ci.org/sindresorhus/widest-line.svg?branch=master)](https://travis-ci.org/sindresorhus/widest-line)
  2. > Get the visual width of the widest line in a string - the number of columns required to display it
  3. Some 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.
  4. Useful to be able to know the maximum width a string will take up in the terminal.
  5. ## Install
  6. ```
  7. $ npm install widest-line
  8. ```
  9. ## Usage
  10. ```js
  11. const widestLine = require('widest-line');
  12. widestLine('古\n\u001B[1m@\u001B[22m');
  13. //=> 2
  14. ```
  15. ## Related
  16. - [string-width](https://github.com/sindresorhus/string-width) - Get the visual width of a string
  17. ## License
  18. MIT © [Sindre Sorhus](https://sindresorhus.com)