1.0.29 • Published 1 year ago
ts-cash v1.0.29
ts-cash
- Format numbers into currency format 👊
- Auto rounding ⚪
- Flexible settings 💪
- Unformatting 🌻
- Convenient methods for calculation 🦾
- Contains 51 currencies, including 41 fiat currencies and 10 cryptocurrencies 😈
Installation
pnpm add ts-cash
Usage example
import { tsCash } from "ts-cash"
const amount1 = tsCash.format(10.01, "EUR");
console.log(amount1.val());
// ✅ result: € 10.01
const amount2 = tsCash.format(10.01, "EUR", {
mathSymbol: {
show: true,
},
currencySymbol: {
show: true,
place: "after",
space: true,
},
decimals: {
separator: ",",
max: 4,
fixed: true,
},
});
amount2.add(20.02);
amount2.sub(10);
amount2.custom((value) => value / 2);
console.log(amount2.val());
// ✅ result: +10,0150 €
console.log(tsCash.unformat("$ 100 000 00. 6"));
// ✅ result: 10000000.6
const amount3 = tsCash.format(0.123456789123456789, "ETH", {
decimals: {
max: 6,
},
});
console.log(amount3.val());
// ✅ result: Ξ 0.123457
Author
Released under the MIT License.
1.0.26
1 year ago
1.0.25
1 year ago
1.0.29
1 year ago
1.0.28
1 year ago
1.0.27
1 year ago
1.0.24
1 year ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.22
2 years ago
1.0.21
2 years ago
1.0.20
2 years ago
1.0.23
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago