This project is instrumented with OpenTelemetry. To enable tracing, you will need to configure the OTLP exporter by setting the following environment variables:
OTEL_EXPORTER_OTLP_ENDPOINTOTEL_EXPORTER_OTLP_HEADERSFor more information, please refer to the OpenTelemetry documentation.
npm install bahtrext@2.5.4
npm install bahtrext@1.7.2
index.test.js101 ควรจะถูกอ่านอย่างไร ?
หนึ่งร้อยหนึ่งบาทถ้วน
Google Sheetsสัญญากู้เงินของธนาคาร* ลองมากู้ได้เลยครับ ถ้าไม่ใช่บอกผมด้วยเอ็ดเมื่อหลักสิบมีค่า เช่น สิบเอ็ด, ยี่สิบเอ็ดหนึ่งร้อยเอ็ดบาทถ้วน
หนึ่งร้อยหนึ่งบาทถ้วน หรือ หนึ่งร้อยเอ็ดบาทถ้วน ก็ได้ ให้เข้าใจได้ตรงกัน
import { MillionScaleText, CompactScaleText } from "bahtrext";
// Source content example: "1 ใน 5,566,857,732,147,160,000,000"
const shortText = MillionScaleText("5,566,857,732,147,160,000,000");
// shortText => "ห้าพันห้าร้อยหกสิบหกล้านล้านล้าน"
const compactText = CompactScaleText(
"1035531362097366437658125676806059750189964336484946134542090486895029450514590979495591124336086177139938812952029085090597851627520000000"
);
// compactText => "1.036 ตามด้วยคำว่า \"ล้าน\" 23 ครั้ง"
CompactScaleText helper for compact scale wordingMillionScaleText helper for compact ล้าน-scale wordingRest Parameters => add function BulkReplace, applyReplacementsBRเอ็ดGoogolplexflowchart TD
A(ABT) -->|input type| B{Type}
B --> |Number| C(iTHBText)
B --> |String| D{Allow Negative ?}
D --> |True| E(NEG)
D --> |False| F(BF)
E --> F(BF)
F --> G(BT)
G --> |Convert Number to Decimal| H(BahtText)
H --> I(MoneyLaundering)
I --> J(splitIntFrac)
J --> |moneyFull| K[/moneyFull/]
J --> |moneyInt| L[/moneyInt/]
J --> |moneyFrac| M[/moneyFrac/]
K --> |moneyFull| N{Match Zero ?}
N --> |True| P[/Zero/]
P --> ZZZ(return)
M --> |moneyFrac| O(PrintSatangs)
O --> |satang_part| R
L --> |moneyInt| Q(PrintBaht)
Q --> |baht_part| R(Concat)
R --> ZZZ