@storepass/money 0.0.1-alpha.5 → 0.1.4
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.
- package/LICENSE +1 -1
- package/README.md +7 -24
- package/package.json +16 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -9,41 +9,24 @@ Safe, consistent, deterministic money operations.
|
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
|
-
Package name: `@atlas-alpha/sp-money`
|
|
13
|
-
|
|
14
|
-
### Current publish target
|
|
15
|
-
|
|
16
|
-
This package is currently configured for GitHub Packages.
|
|
17
|
-
|
|
18
12
|
```bash
|
|
19
13
|
# npm
|
|
20
|
-
npm install @
|
|
14
|
+
npm install @storepass/money
|
|
21
15
|
|
|
22
16
|
# pnpm
|
|
23
|
-
pnpm add @
|
|
17
|
+
pnpm add @storepass/money
|
|
24
18
|
|
|
25
19
|
# yarn
|
|
26
|
-
yarn add @
|
|
20
|
+
yarn add @storepass/money
|
|
27
21
|
|
|
28
22
|
# bun
|
|
29
|
-
bun add @
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
If your org requires explicit registry config:
|
|
33
|
-
|
|
34
|
-
```ini
|
|
35
|
-
# .npmrc
|
|
36
|
-
@atlas-alpha:registry=https://npm.pkg.github.com
|
|
23
|
+
bun add @storepass/money
|
|
37
24
|
```
|
|
38
25
|
|
|
39
|
-
### Open-source transition
|
|
40
|
-
|
|
41
|
-
The project is being prepared for a public open-source release.
|
|
42
|
-
|
|
43
26
|
## Quick Start
|
|
44
27
|
|
|
45
28
|
```ts
|
|
46
|
-
import { Currency, Money } from "@
|
|
29
|
+
import { Currency, Money } from "@storepass/money";
|
|
47
30
|
|
|
48
31
|
const price = Money.fromMinor(Currency.USD, 1234); // $12.34
|
|
49
32
|
const fee = Money.fromNumber(Currency.USD, 1.25);
|
|
@@ -59,7 +42,7 @@ console.log(total.currency.code); // "USD"
|
|
|
59
42
|
### Money creation
|
|
60
43
|
|
|
61
44
|
```ts
|
|
62
|
-
import { Currency, Money } from "@
|
|
45
|
+
import { Currency, Money } from "@storepass/money";
|
|
63
46
|
|
|
64
47
|
Money.fromMinor(Currency.USD, 1234); // $12.34
|
|
65
48
|
Money.fromNumber(Currency.USD, 12.345, { rounding: "round" }); // $12.35
|
|
@@ -112,7 +95,7 @@ subtotal.decrementByPercent(10).toNumber(); // 90
|
|
|
112
95
|
### Custom currencies
|
|
113
96
|
|
|
114
97
|
```ts
|
|
115
|
-
import { defineCurrency, Money } from "@
|
|
98
|
+
import { defineCurrency, Money } from "@storepass/money";
|
|
116
99
|
|
|
117
100
|
const XAU = defineCurrency("XAU", 4);
|
|
118
101
|
const gold = Money.fromNumber(XAU, 1.2345);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storepass/money",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Money primitive library",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -32,6 +32,21 @@
|
|
|
32
32
|
"lint": "biome lint .",
|
|
33
33
|
"lint:fix": "biome lint --write ."
|
|
34
34
|
},
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"author": "darling (https://github.com/darling)",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/Atlas-Alpha/sp-money"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/Atlas-Alpha/sp-money#readme",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/Atlas-Alpha/sp-money/issues"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"money",
|
|
47
|
+
"currency",
|
|
48
|
+
"finance"
|
|
49
|
+
],
|
|
35
50
|
"engines": {
|
|
36
51
|
"node": ">=16"
|
|
37
52
|
},
|