Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

thai-baht-text

antronic12.5kMIT2.0.5TypeScript support: included

Convert number to Thai Bath as Text

Thai, baht, text, ThaiBaht, ThaiBahtText, Thai baht, Thai baht text, convert, javascript, typescript, Thai baht text js, แปลงเลขไทย, แปลงเลขเงินไทย, convert thai baht

readme

Thai Baht Text JS

NPM Download codecov-svg NPM Version license-svg ts

Installation | Usage

Now, Thai Baht text supports TypeScript 🎉!!

Thai Baht Text JS converts numbers into Thai text. It provides flexibility as a cross-platform library for both browser and Node.js, written in TypeScript.

In the browser, you can simply add thai-baht-text.min.js in a script tag without needing to install any additional libraries or polyfills.

> 10050
// หนึ่งหมื่นห้าสิบบาทถ้วน

Installation | วิธีติดตั้ง

npm install thai-baht-text --save

or

yarn add thai-baht-text

Usage | วิธีการใช้งาน

Javascript ES5

const ThaiBahtText = require('thai-baht-text') // for ES5

let money = 10050
let moneyText = ThaiBahtText(money)

console.log(moneyText)
// OUTPUT: หนึ่งหมื่นห้าสิบบาทถ้วน

money = 12345678988888.50

console.log(ThaiBahtText(money))
// OUTPUT: สิบสองล้านล้านสามแสนสี่หมื่นห้าพันหกร้อยเจ็ดสิบแปดล้านเก้าแสนแปดหมื่นแปดพันแปดร้อยแปดสิบแปดบาทห้าสิบสตางค์

More infomation ES5 Example


Javascript ES6

import ThaiBahtText from 'thai-baht-text'

let money = 10050
const moneyText = ThaiBahtText(money)

console.log(moneyText)
// OUTPUT: หนึ่งหมื่นห้าสิบบาทถ้วน

money = 12345678988888.50

console.log(ThaiBahtText(money))
// OUTPUT: สิบสองล้านล้านสามแสนสี่หมื่นห้าพันหกร้อยเจ็ดสิบแปดล้านเก้าแสนแปดหมื่นแปดพันแปดร้อยแปดสิบแปดบาทห้าสิบสตางค์

More infomation ES6 Example

More infomation Browser version (UMD)

Development

  • npm run test to run all tests in this project
  • npm run test:watch to run all tests in watch mode. This allows us to develop/refactor code and get fast feedback to ensure we don't break anything.

Library & Development Tools

License

The Thai-Baht-Text JS is open-sourced software licensed under the MIT license.

Ending message

If you found bugs or some missing point, please send pull request back or open an issue.

Thank you so much 😃

Regards,

Jirachai Chansivanon





แปลง เลข เป็น บาทไทย,

thai baht text javascript,

thai baht text js that-baht-text.js that-baht-text.js typescript

Convert number to Thai Baht as Text

แปลงเลขให้เป็นหน่วยบาทไทย