Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
get-east-asian-width
Advanced tools
Readme
Determine the East Asian Width of a Unicode character
East Asian Width categorizes Unicode characters based on their occupied space in East Asian typography, which helps in text layout and alignment, particularly in languages like Japanese, Chinese, and Korean.
Unlike other similar packages, this package uses the latest Unicode data (which changes each year).
npm install get-east-asian-width
import {eastAsianWidth, eastAsianWidthType} from 'get-east-asian-width';
const codePoint = '字'.codePointAt(0);
console.log(eastAsianWidth(codePoint));
//=> 2
console.log(eastAsianWidthType(codePoint));
//=> 'wide'
eastAsianWidth(codePoint: number, options?: object): 1 | 2
Returns the width as a number for the given code point.
Type: object
Type: boolean
Default: false
Whether to treat an 'ambiguous'
character as wide.
import {eastAsianWidth} from 'get-east-asian-width';
const codePoint = '⛣'.codePointAt(0);
console.log(eastAsianWidth(codePoint));
//=> 1
console.log(eastAsianWidth(codePoint, {ambiguousAsWide: true}));
//=> 2
Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). If the context cannot be established reliably, they should be treated as narrow characters by default.
eastAsianWidthType(codePoint: number): 'fullwidth' | 'halfwidth' | 'wide' | 'narrow' | 'neutral' | 'ambiguous'
Returns the type of “East Asian Width” for the given code point.
FAQs
Determine the East Asian Width of a Unicode character
The npm package get-east-asian-width receives a total of 2,963,347 weekly downloads. As such, get-east-asian-width popularity was classified as popular.
We found that get-east-asian-width demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.