Spaces:
Paused
Paused
Download frontend/src/components/format.ts from atharvgaur18/bidbrain: direct link, hf CLI and curl.
- Browser
- Download file 447 Bytes
-
https://huggingface.co/spaces/atharvgaur18/bidbrain/resolve/main/frontend/src/components/format.ts
- Command line
-
hf download hf://spaces/atharvgaur18/bidbrain/frontend/src/components/format.ts
-
curl -L -o format.ts https://huggingface.co/spaces/atharvgaur18/bidbrain/resolve/main/frontend/src/components/format.ts
447 Bytes
| import { fmtINR } from "@/lib/api"; | |
| /** Rupee amounts written as raw digits ("2,000,000,000", "1880000000") -> "₹200 Cr". Seven or more digits only, | |
| * so dates, page numbers and ids are left alone. */ | |
| export const moneyText = (s?: string | null) => | |
| (s ?? "").replace(/(?<![\w-])(\d{1,3}(?:,\d{2,3}){2,}|\d{7,})(?:\.\d+)?(?![\w-])/g, (m) => { | |
| const n = Number(m.replace(/,/g, "")); | |
| return n >= 1e6 && n < 1e13 ? fmtINR(n) : m; | |
| }); | |