lao_num2word
v1.0.3
Published
A lightweight library to convert numbers into words in both English and Lao languages.
Downloads
246
Maintainers
Readme
Lao Number to Words (lao_num2word)
A lightweight library to convert numbers into words in both English and Lao languages.
Features
- Converts numbers to English words (e.g.,
123 -> "one hundred twenty-three"
). - Converts numbers to Lao words (e.g.,
123 -> "ໜຶ່ງຮ້ອຍຊາວສາມ"
).
Installation
Install the package using npm:
npm install lao_num2word
Usage
Import the Library
const { numberToWordsEN, numberToWordsLA } = require('lao_num2word');
// Convert an integer to English words
console.log(numberToWordsEN(123)); // "one hundred twenty-three"
// Convert a larger number
console.log(numberToWordsEN(4567)); // "four thousand, five hundred sixty-seven"
// Handle negative numbers
console.log(numberToWordsEN(-98)); // "minus ninety-eight"
// Ordinals (optional implementation required)
console.log(numberToWordsEN(21, true)); // "twenty-first"
// Convert an integer to Lao words
console.log(numberToWordsLA(123)); // "ໜຶ່ງຮ້ອຍຊາວສາມ"
// Convert a larger number
console.log(numberToWordsLA(4567)); // "ສີ່ພັນຫ້າຮ້ອຍສິບເຈັດ"
// Handle millions
console.log(numberToWordsLA(1234567)); // "ໜຶ່ງລ້ານສອງແສນສາມພັນສີ່ຮ້ອຍສິບເຈັດ"