Skip to content

shinshin86/deno_eastasianwidth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno porting of East Asian Width

Deno CI

Deno porting of eastasianwidth

Usage

import {
  characterLength,
  eastAsianWidth,
  length,
} from "https://deno.land/x/deno_eastasianwidth@v0.1.1/mod.ts";

console.log(eastAsianWidth("₩")); // 'F'
console.log(eastAsianWidth("。")); // 'H'
console.log(eastAsianWidth("뀀")); // 'W'
console.log(eastAsianWidth("a")); // 'Na'
console.log(eastAsianWidth("①")); // 'A'
console.log(eastAsianWidth("ف")); // 'N'

console.log(characterLength("₩")); // 2
console.log(characterLength("。")); // 1
console.log(characterLength("뀀")); // 2
console.log(characterLength("a")); // 1
console.log(characterLength("①")); // 2
console.log(characterLength("ف")); // 1

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

Test

deno test

If the version is older than 1.18, add --unstable.

deno test --unstable

Thank you

The implementation in this repository is a port of the implementation in this repository (East Asian Width) for Deno.

Licence

MIT

The Licence is MIT, according to the license of the ported code.

About

Deno porting of https://github.com/komagata/eastasianwidth

Resources

License

Stars

Watchers

Forks

Packages

No packages published