Socket
Socket
Sign inDemoInstall

get-east-asian-width

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-east-asian-width

Determine the East Asian Width of a Unicode character


Version published
Weekly downloads
6.8M
increased by5.47%
Maintainers
1
Weekly downloads
 
Created

What is get-east-asian-width?

The get-east-asian-width npm package is used to determine the East Asian Width properties of Unicode characters. This is useful for applications that need to handle text rendering, alignment, or width calculations in East Asian languages.

What are get-east-asian-width's main functionalities?

Get East Asian Width of a character

This feature allows you to get the East Asian Width property of a single character. In this example, the character 'あ' has a width property of 'W' (Wide).

const getEastAsianWidth = require('get-east-asian-width');
const width = getEastAsianWidth('あ');
console.log(width); // Output: 'W'

Get East Asian Width of a string

This feature allows you to get the East Asian Width properties of each character in a string. In this example, each character in the string 'こんにちは' has a width property of 'W' (Wide).

const getEastAsianWidth = require('get-east-asian-width');
const widths = 'こんにちは'.split('').map(getEastAsianWidth);
console.log(widths); // Output: ['W', 'W', 'W', 'W', 'W']

Check if a character is Fullwidth or Halfwidth

This feature allows you to check if a character is Fullwidth or Halfwidth. In this example, the character 'A' is Fullwidth, while 'A' is not.

const getEastAsianWidth = require('get-east-asian-width');
const isFullwidth = (char) => getEastAsianWidth(char) === 'F';
console.log(isFullwidth('A')); // Output: true
console.log(isFullwidth('A')); // Output: false

Other packages similar to get-east-asian-width

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