node/deps/npm/node_modules/widest-line
Ruy Adorno b2e1a01516
deps: upgrade npm to 6.14.4
PR-URL: https://github.com/nodejs/node/pull/32495
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2020-03-26 13:28:08 -04:00
..
index.js deps: upgrade npm to 6.14.4 2020-03-26 13:28:08 -04:00
license deps: upgrade npm to 6.1.0 2018-05-24 23:24:45 -07:00
package.json deps: upgrade npm to 6.14.4 2020-03-26 13:28:08 -04:00
readme.md deps: upgrade npm to 6.1.0 2018-05-24 23:24:45 -07:00

widest-line Build Status

Get the visual width of the widest line in a string - the number of columns required to display it

Some Unicode characters are fullwidth and use double the normal width. ANSI escape codes are stripped and doesn't affect the width.

Useful to be able to know the maximum width a string will take up in the terminal.

Install

$ npm install widest-line

Usage

const widestLine = require('widest-line');

widestLine('古\n\u001B[1m@\u001B[22m');
//=> 2

License

MIT © Sindre Sorhus