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

wcwidth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wcwidth

Port of C's wcwidth() and wcswidth()

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22M
decreased by-0.08%
Maintainers
1
Weekly downloads
 
Created

What is wcwidth?

The wcwidth npm package is designed to provide functionality for determining the display width of characters in the terminal. This is particularly useful for handling characters that may take up more than one column in width, such as certain emojis or characters from languages like Chinese, Japanese, and Korean. It helps in ensuring text alignment and proper spacing in terminal applications that deal with diverse character sets.

What are wcwidth's main functionalities?

Calculate display width of a string

This feature allows you to calculate the display width of a string, which is essential for text alignment in terminal applications. The code sample demonstrates how to use wcwidth to determine the display width of English and Chinese text.

const wcwidth = require('wcwidth');
console.log(wcwidth('hello')); // Outputs: 5
console.log(wcwidth('你好')); // Outputs: 4

Other packages similar to wcwidth

Keywords

FAQs

Package last updated on 30 May 2016

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