1.0.5 • Published 1 month ago

words-countries v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

NPM

words-countries

Convert numbers to words for popular languages for countries in Asia and Europe. Language support: Vietnamese, English, Chinese, Korean, Japanese, French, German, Italian, Spanish, Russian.

Install

npm i words-countries

Example Result

"vi" : [ 'một', 'trăm', 'hai', 'mươi' ]
"en" : [ 'one', 'hundred', 'twenty' ]
"zh" : [ '一', '百', '二', '十' ]
"ko" : [ '백', '이', '십' ]
"ja" : [ '百', '二', '十' ]

{ base: [ 'one', 'hundred', 'twenty' ], words: 'one hundred twenty' }

Use

const { numberToWords } = require('words-countries')
const result = numberToWords({ number: "120" })
console.log('result:', result)

Type numberToWords({code, type, number})

Code : string
{
    "vi" : "Vietnamses"
    "en" : "English"
    "zh" : "China"
    "ko" : "Korean"
    "ja" : "Japanese"
    "fr" : "Francais"
    "it" : "Italiano"
    "es" : "Spanish"
    "ru" : "Pyccknn"
    "de" : "Deutsch"
}

Type [1, 2]: number
1: Read each number. Example: [ 'one', 'two', 'zero' ]
2: Basic. Example: [ 'one', 'hundred', 'twenty' ]

Number : string | number