sandar
v0.0.5
Published
Kyrgyz / Kazakh numbers to words converter
Downloads
16
Maintainers
Readme
Install
npm i sandar
import:
//CommonJS
const { toWord, ... } = require('sandar')
//ESM
import { toOrdinal, ... } from 'sandar'
Usage
- Passing number as
string
is recommended.
toWord
Returns the textual representation of a given number.
toWord(123) //=> 'жүз жыйырма үч'
toWord(456, { lang: 'ky' }) //=> 'төрт жүз элүү алты'
toWord('789', 'kk-latin') //=> 'jetı jüz seksen toğyz'
toWord('123456789101112131415') //=> 'жүз жыйырма үч секстиллион төрт жүз элүү алты квадриллион жети жүз сексен тогуз триллион жүз бир миллиард жүз он эки миллион жүз отуз бир миң төрт жүз он беш'
toOrdinal
Returns the textual ordinal representation of a given number.
toOrdinal(123) //=> 'жүз жыйырма үчүнчү'
toOrdinal(456, { lang: 'kk' }) //=> 'төрт жүз елу алтыншы'
toOrdinal('789', 'kk-latin') //=> 'jetı jüz seksen toğyzınşı'
toOrdinal('123456789101112131415') //=> 'жүз жыйырма үч секстиллион төрт жүз элүү алты квадриллион жети жүз сексен тогуз триллион жүз бир миллиард жүз он эки миллион жүз отуз бир миң төрт жүз он бешинчи'
Sandar
class
By invoking Sandar
class, further specifying of the language is not needed
import { Sandar } from 'sandar'
// const san = new Sandar() Kyrgyz language `ky` is set by default, if language is not specified
const san = new Sandar('kk-latin')
// from now on instance of class will always return the output in the speficied language
san.toWord(123) //=> 'jüz jiyrma üş'
san.lang = 'kk' // `.lang` is a setter and a getter.п
san.toOrdinal(456) //=> 'төрт жүз елу алтыншы'