Download lib/format.ts from phungtuan/fluxify: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/phungtuan/fluxify/resolve/main/lib/format.ts
- Command line
-
hf download hf://spaces/phungtuan/fluxify/lib/format.ts
-
curl -L -o format.ts https://huggingface.co/spaces/phungtuan/fluxify/resolve/main/lib/format.ts
447 Bytes
| /** | |
| * Utility functions for formatting Vietnamese currency and phone numbers | |
| */ | |
| /** | |
| * Format a number as Vietnamese Dong (VND) | |
| * Example: 123456 => "123.456₫" | |
| */ | |
| export function formatVND(amount: number | string): string { | |
| const num = typeof amount === "string" ? parseFloat(amount) : amount; | |
| if (isNaN(num)) return "0₫"; | |
| // Format with thousand separators using Vietnamese locale | |
| return num.toLocaleString("vi-VN") + "₫"; | |
| } | |