Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

widest-line

Package Overview
Dependencies
Maintainers
1
Versions
8
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

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12M
decreased by-16.3%
Maintainers
1
Weekly downloads
 
Created

What is widest-line?

The widest-line npm package is designed to find and return the length of the longest line in a string, taking into account and handling ANSI escape codes which are often used for coloring or styling terminal output. This can be particularly useful when trying to format console output or determine the necessary width for a text-based UI component.

What are widest-line's main functionalities?

Get the length of the longest line in a string

This feature allows you to determine the length of the longest line in a given multi-line string, which can be useful for formatting console output or for creating text-based UI components that need to accommodate variable-length content.

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

const text = 'Some string with\nseveral lines\nand varying lengths.';
const longestLineLength = widestLine(text);
console.log(longestLineLength); // Outputs the length of the widest line"

Other packages similar to widest-line

Keywords

FAQs

Package last updated on 28 Oct 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc