formatNumber
Formats a number with thousands separators and decimal places.| Argument | Type | Default | Description |
|---|---|---|---|
number | number | required | Number to format |
decimals | number | 2 | Decimal places |
thousandsSep | string | ”,“ | Thousands separator |
decimalSep | string | ”.” | Decimal separator |
1,234,567.00
1,234,567
1.234.567,89
currency
Formats a number as currency with proper symbol and locale.| Argument | Type | Default | Description |
|---|---|---|---|
amount | number | required | Amount to format |
currencyCode | string | ”USD” | ISO 4217 currency code |
locale | string | ”en-US” | Locale for formatting |
$1,234.56
€1,234.56
£1,234.56
¥1,235 (JPY has no decimals)
1.234,56 €
Supported Currency Codes
Common currency codes include:| Code | Currency | Symbol |
|---|---|---|
| USD | US Dollar | $ |
| EUR | Euro | € |
| GBP | British Pound | £ |
| JPY | Japanese Yen | ¥ |
| CNY | Chinese Yuan | ¥ |
| INR | Indian Rupee | ₹ |
| CAD | Canadian Dollar | C$ |
| AUD | Australian Dollar | A$ |
| BRL | Brazilian Real | R$ |
| KRW | Korean Won | ₩ |
percentage
Calculates and formats a percentage.| Argument | Type | Default | Description |
|---|---|---|---|
value | number | required | The part |
total | number | 1 | The whole |
decimals | number | 1 | Decimal places |
75.0%
33.33%
formatBytes
Formats bytes into human-readable file sizes.| Argument | Type | Default | Description |
|---|---|---|---|
bytes | number | required | Size in bytes |
decimals | number | 2 | Decimal places |
0 Bytes
1 KB
1.46 MB
1 GB
| Input | Output |
|---|---|
| 500 | 500 Bytes |
| 1024 | 1 KB |
| 1048576 | 1 MB |
| 1073741824 | 1 GB |
| 1099511627776 | 1 TB |
ordinal
Adds ordinal suffix to a number (1st, 2nd, 3rd, etc.).1st, 2nd, 3rd, 4th
Examples:

