monetra 0.0.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -15
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -16,6 +16,10 @@ It is intended for use in wallet-based financial systems where correctness is pa
16
16
  - ✅ **Immutable**: All operations return new objects.
17
17
  - ✅ **Locale-aware formatting**: Built on `Intl` standards.
18
18
  - ✅ **Allocation Engine**: Deterministic splitting of funds (e.g., 33% / 33% / 34%).
19
+ - ✅ **Smart Syntax**: Intuitive API that accepts numbers and strings directly.
20
+ - ✅ **Multi-Currency Wallets**: Built-in `MoneyBag` for managing portfolios.
21
+ - ✅ **Currency Conversion**: Robust `Converter` with exchange rate support.
22
+ - ✅ **Financial Primitives**: Helpers for tax, discounts, and splitting.
19
23
 
20
24
  ## Table of Contents
21
25
 
@@ -25,6 +29,7 @@ It is intended for use in wallet-based financial systems where correctness is pa
25
29
  - [Documentation](#documentation)
26
30
  - [Testing](#testing)
27
31
  - [Contributing](#contributing)
32
+ - [Security](#security)
28
33
  - [License](#license)
29
34
 
30
35
  ## Quick Start
@@ -42,24 +47,17 @@ pnpm add monetra
42
47
  ### Basic Usage
43
48
 
44
49
  ```typescript
45
- import { Money, USD, RoundingMode } from "monetra";
50
+ import { money, USD } from "monetra";
46
51
 
47
- // Create money from major units (e.g., "10.50")
48
- const price = Money.fromMajor("10.50", USD);
52
+ // Create money easily
53
+ const price = money("10.50", "USD"); // $10.50
54
+ const tax = price.percentage(10); // $1.05
49
55
 
50
- // Create money from minor units (e.g., 100 cents)
51
- const tax = Money.fromMinor(100, USD); // $1.00
56
+ // Smart arithmetic
57
+ const total = price.add(tax); // $11.55
58
+ const discounted = total.subtract("2.00"); // $9.55
52
59
 
53
- // Arithmetic
54
- const total = price.add(tax); // $11.50
55
-
56
- // Formatting
57
- console.log(total.format()); // "$11.50"
58
- console.log(total.format({ locale: "de-DE" })); // "11,50 $"
59
-
60
- // Multiplication with explicit rounding
61
- const discount = total.multiply(0.15, { rounding: RoundingMode.HALF_UP });
62
- const finalPrice = total.subtract(discount);
60
+ console.log(discounted.format()); // "$9.55"
63
61
  ```
64
62
 
65
63
  ## Core Concepts
@@ -135,6 +133,12 @@ npm run test:coverage
135
133
 
136
134
  Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to get started.
137
135
 
136
+ We also have a [Code of Conduct](CODE_OF_CONDUCT.md) that all contributors are expected to follow.
137
+
138
+ ## Security
139
+
140
+ If you discover a security vulnerability, please review our [Security Policy](SECURITY.md) for instructions on how to report it responsibly.
141
+
138
142
  ## License
139
143
 
140
144
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monetra",
3
- "version": "0.0.2",
3
+ "version": "1.0.0",
4
4
  "description": "A currency-aware, integer-based money engine designed for financial correctness.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "repository": {
29
29
  "type": "git",
30
- "url": "git+https://github.com/zugobite/monetra.git"
30
+ "url": "https://github.com/zugobite/monetra.git"
31
31
  },
32
32
  "bugs": {
33
33
  "url": "https://github.com/zugobite/monetra/issues"