widest-line

5.0.0last stable release 1 year ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
320
Weekly Downloadsglobal
15,085,807

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Readme

widest-line

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

import widestLine from 'widest-line';

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

Related

  • string-width - Get the visual width of a string

Dependencies

CVE IssuesActive
0
Scorecards Score
4.20
Test Coverage
No Data
Follows Semver
Yes
Github Stars
37
Dependenciestotal
4
DependenciesOutdated
3
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute widest-line in your own private NPM registry

npm config set registry  https://npm.cloudsmith.com/owner/repo
Processing...
Done
npm install widest-line
Processing...
Done

8 Releases

NPM on Cloudsmith

Getting started with NPM on Cloudsmith is fast and easy.