Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

widest-line

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

widest-line

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

latest
Source
npmnpm
Version
6.0.0
Version published
Weekly downloads
27M
3.23%
Maintainers
1
Weekly downloads
 
Created
Source

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
  • string-width - Get the visual width of a string

Keywords

string

FAQs

Package last updated on 24 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts