1.0.1 • Published 3 years ago

@leonsk32/japanese-numeral-utils v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

japanese-numeral-utils

Utilities for handling Japanese numerals.

Latest NPM release MIT License

Installation

$ npm install @leonsk32/japanese-numeral-utils --save

Usage

import { 
  fullWidthAlphabet2HalfWidthAlphabet,
  isFullWidthAlphabetical,
  isKanjiNumeric,
  kanji2Arabic,
  halfWidthText2FullWidthText
} from "@leonsk32/japanese-numeral-utils";

console.log(kanji2Arabic("九千八百七十六兆五千四百三十二億九千八百七十六万五千四百三十二"));
// "9876543298765432"

console.log(kanji2Arabic("一二三四五六七八九〇"));
// "1234567890"

console.log(kanji2Arabic("四百五千")); // invalid kanji number
// throw TypeError

console.log(isKanjiNumeric("〇一二三四五六七八九"));
// true

console.log(isKanjiNumeric("123"));
// false

console.log(fullWidthAlphabet2HalfWidthAlphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
// "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

console.log(fullWidthAlphabet2HalfWidthAlphabet("ABCD"));
// "ABCD"

console.log(isFullWidthAlphabetical("ABCabc"));
// true

console.log(isFullWidthAlphabetical("abcABC"));
// false

console.log(halfWidthText2FullWidthText("アカサABCz123abc"))
// "アカサABCz123abc"

console.log(halfWidthText2FullWidthText("あABCい"))
// "あABCい"
1.0.1

3 years ago

1.0.0

3 years ago

0.3.2

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago