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

display-width

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

display-width

A node.js port of [uwcwidth](https://github.com/Z4JC/uwcwidth), a fast function for determining a string's display width

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-22.22%
Maintainers
0
Weekly downloads
 
Created
Source

display-width

A node.js port of uwcwidth, a fast function for determining a string's display width

How to use it

import { wcswidth } from "display-width";

// wcswidth("👩‍❤️‍👨") == 2
console.log(wcswidth("\u{1F469}\u{200D}\u{2764}\u{FE0F}\u{200D}\u{1F468}"));

Why to use it

>> wcswidth("café") == 4
>> "café".length == 5

>> wcswidth("⚠︎ warning") == 9
>> "⚠︎ warning".length == 10

>> wcswidth("👨‍👨‍👧‍👧") == 2
>> "👨‍👨‍👧‍👧".length == 11

>> wcswidth("👩‍❤️‍👨") == 2
>> "👩‍❤️‍👨".length == 8

Is it fast?

yes!

Is it large?

no!

Does it have any dependencies?

no!

Do you completely understand it?

no! I ported the code and all the tests from uwcwidth though, so I have good vibes about it

FAQs

Package last updated on 24 Oct 2024

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