Coder Social home page Coder Social logo

eastasianwidth's Introduction

East Asian Width

Get East Asian Width from a character.

'F'(Fullwidth), 'H'(Halfwidth), 'W'(Wide), 'Na'(Narrow), 'A'(Ambiguous) or 'N'(Natural).

Original Code is 東アジアの文字幅 (East Asian Width) の判定 - 中途.

Install

$ npm install eastasianwidth

Usage

var eaw = require('eastasianwidth');
console.log(eaw.eastAsianWidth('₩')) // 'F'
console.log(eaw.eastAsianWidth('。')) // 'H'
console.log(eaw.eastAsianWidth('뀀')) // 'W'
console.log(eaw.eastAsianWidth('a')) // 'Na'
console.log(eaw.eastAsianWidth('①')) // 'A'
console.log(eaw.eastAsianWidth('ف')) // 'N'

console.log(eaw.characterLength('₩')) // 2
console.log(eaw.characterLength('。')) // 1
console.log(eaw.characterLength('뀀')) // 2
console.log(eaw.characterLength('a')) // 1
console.log(eaw.characterLength('①')) // 2
console.log(eaw.characterLength('ف')) // 1

console.log(eaw.length('あいうえお')) // 10
console.log(eaw.length('abcdefg')) // 7
console.log(eaw.length('¢₩。ᅵㄅ뀀¢⟭a⊙①بف')) // 19

eastasianwidth's People

Contributors

jamestalmage avatar kjirou avatar komagata avatar polyipseity avatar rudolph-miller avatar skytomo221 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

eastasianwidth's Issues

Incorrect width for zhuyin tone marks

Thanks for this library. I am building a typing speed training game for Zhuyin (注音) input and this will be convenient.

The tone marks from Zhuyin input are incorrectly having a length of 2 when they should be 1.

const eaw = require("eastasianwidth")

eaw.characterLength("ˋ") // 2
eaw.characterLength("ˇ") // 2
eaw.characterLength("˙") // 2
eaw.characterLength("ˊ") // 2

The licence file is absent.

It would be nice to add a license file in order to get a possibility use this library for enterprise projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.