Deno porting of eastasianwidth
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⊙①بف")); // 19deno testIf the version is older than 1.18, add --unstable.
deno test --unstableThe implementation in this repository is a port of the implementation in this repository (East Asian Width) for Deno.
The Licence is MIT, according to the license of the ported code.