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

eastasianwidth

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eastasianwidth

Get East Asian Width from a character.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28M
increased by0.92%
Maintainers
1
Weekly downloads
 
Created

What is eastasianwidth?

The eastasianwidth npm package is a utility for determining the East Asian Width property of Unicode characters, which is useful for handling text display in console applications or any other context where monospaced font rendering is involved. It helps to classify characters based on their expected display width, especially when dealing with East Asian characters.

What are eastasianwidth's main functionalities?

Check character width

This feature allows you to check the East Asian Width property of a character. The output 'F' indicates that the character is a fullwidth character.

"use strict";
const eastasianwidth = require('eastasianwidth');

let char = 'あ';
let width = eastasianwidth.eastAsianWidth(char);
console.log(width); // Output: 'F' (Fullwidth)

Determine if a character is fullwidth

This feature provides a boolean indicating whether a character is fullwidth or not.

"use strict";
const eastasianwidth = require('eastasianwidth');

let char = 'あ';
let isFullwidth = eastasianwidth.isFullwidth(char);
console.log(isFullwidth); // Output: true

Determine if a character is halfwidth

This feature provides a boolean indicating whether a character is halfwidth or not.

"use strict";
const eastasianwidth = require('eastasianwidth');

let char = 'ア'; // Halfwidth Katakana Letter A
let isHalfwidth = eastasianwidth.isHalfwidth(char);
console.log(isHalfwidth); // Output: true

Other packages similar to eastasianwidth

FAQs

Package last updated on 21 Apr 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