dinero.js 1.9.1
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.md +7 -0
- package/README.md +316 -0
- package/build/amd/dinero.js +1659 -0
- package/build/amd/dinero.min.js +1 -0
- package/build/amd/dinero.polyfilled.js +3964 -0
- package/build/amd/dinero.polyfilled.min.js +1 -0
- package/build/cjs/dinero.js +1657 -0
- package/build/cjs/dinero.min.js +1 -0
- package/build/cjs/dinero.polyfilled.js +3962 -0
- package/build/cjs/dinero.polyfilled.min.js +1 -0
- package/build/esm/dinero.js +1655 -0
- package/build/esm/dinero.min.js +1 -0
- package/build/esm/dinero.polyfilled.js +3960 -0
- package/build/esm/dinero.polyfilled.min.js +1 -0
- package/build/umd/dinero.js +1663 -0
- package/build/umd/dinero.min.js +1 -0
- package/build/umd/dinero.polyfilled.js +3968 -0
- package/build/umd/dinero.polyfilled.min.js +1 -0
- package/package.json +83 -0
- package/src/dinero-polyfilled.js +13 -0
- package/src/dinero.js +970 -0
- package/src/services/assert.js +59 -0
- package/src/services/calculator.js +122 -0
- package/src/services/currency-converter.js +38 -0
- package/src/services/format.js +76 -0
- package/src/services/helpers.js +193 -0
- package/src/services/settings.js +62 -0
- package/src/services/static.js +103 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2018 Sarah Dayan
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
<h1 align="center">Dinero.js</h1>
|
|
2
|
+
|
|
3
|
+
<div align="center"><img alt="" height="150" src="https://raw.githubusercontent.com/dinerojs/dinero.js/develop/logo.png" /></div>
|
|
4
|
+
|
|
5
|
+
<div align="center">Dinero.js is a library for working with monetary values in JavaScript.</div>
|
|
6
|
+
|
|
7
|
+
<div align="center" style="margin:15px 0">
|
|
8
|
+
<a href="https://github.com/dinerojs/dinero.js/blob/master/LICENSE.md">
|
|
9
|
+
<img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/dinero.js">
|
|
12
|
+
<img alt="NPM version" src="https://img.shields.io/npm/v/dinero.js.svg" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://coveralls.io/github/dinerojs/dinero.js?branch=master">
|
|
15
|
+
<img alt="Coverage Status" src="https://img.shields.io/coveralls/github/dinerojs/dinero.js.svg?branch=master" />
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://github.com/semantic-release/semantic-release">
|
|
18
|
+
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" />
|
|
19
|
+
</a>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div align="center"><a href="https://dinerojs.com/module-dinero">See full API docs</a></div>
|
|
23
|
+
|
|
24
|
+
<hr>
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Immutable and chainable API.
|
|
29
|
+
- Global settings support.
|
|
30
|
+
- Extended formatting and rounding options.
|
|
31
|
+
- Native Intl support (no additional locale files).
|
|
32
|
+
- Currency conversion.
|
|
33
|
+
|
|
34
|
+
> Dinero.js v2 is in alpha! Check it out on the [`main` branch](https://github.com/dinerojs/dinero.js/tree/main).
|
|
35
|
+
|
|
36
|
+
## Download/install
|
|
37
|
+
|
|
38
|
+
Dinero.js provides builds for different environments. It also comes with polyfilled versions for older browsers.
|
|
39
|
+
|
|
40
|
+
The recommended way of install is via [npm][npm] or [Yarn][yarn]:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm install dinero.js --save
|
|
44
|
+
|
|
45
|
+
// or
|
|
46
|
+
|
|
47
|
+
yarn add dinero.js
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
You can also [download the files directly][jsdelivr:landing] or use the [jsDelivr CDN][jsdelivr:cdn].
|
|
51
|
+
|
|
52
|
+
### UMD (browser global)
|
|
53
|
+
|
|
54
|
+
Include Dinero.js in a script tag and access its methods through the global `Dinero` variable.
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<script src="path/to/umd/dinero.js"></script>
|
|
58
|
+
<script>
|
|
59
|
+
Dinero();
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
You can use an alias if you wish:
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
var Money = Dinero
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Any browser that supports the [Internationalization API][mdn:intl] is compatible with Dinero.js. This means [most browsers][caniuse:intl], and Internet Explorer 11 (this one requires the polyfilled version).
|
|
70
|
+
|
|
71
|
+
### CommonJS (Node)
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
const Dinero = require('dinero.js')
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You will need at least Node 6+ [with full-icu support][node:full-icu].
|
|
78
|
+
|
|
79
|
+
### AMD (RequireJS, System.js, etc.)
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
requirejs(['path/to/amd/dinero'], function(Dinero) {
|
|
83
|
+
//...
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### ES modules (modern browser, Webpack, etc.)
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
import Dinero from 'path/to/esm/dinero.js'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### TypeScript
|
|
94
|
+
|
|
95
|
+
For Typescript typings, you can use the definition file from [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
npm install @types/dinero.js --save
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**This is a third-party file.** Please report issues and open PRs for it on the [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) repository.
|
|
102
|
+
|
|
103
|
+
### React Native
|
|
104
|
+
|
|
105
|
+
Dinero uses [`Number.prototype.toLocaleString`](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Number/toLocaleString), which by default **isn't bundled with React Native (0.60+) on Android devices**. For formatting and currency symbols to display properly, you need to change the preferred build flavor of JavaScriptCore in your project by opening `./android/app/build.gradle` and changing the line `def jscFlavor = 'org.webkit:android-jsc:+'` to `def jscFlavor = 'org.webkit:android-jsc-intl:+'`.
|
|
106
|
+
|
|
107
|
+
## Quick start
|
|
108
|
+
|
|
109
|
+
Dinero.js makes it easy to create, calculate and format monetary values in JavaScript. You can perform arithmetic operations, extensively parse and format them, check for a number of things to make your own development process easier and safer.
|
|
110
|
+
|
|
111
|
+
**Note:** The library is globally available in the docs for you to be able to test it right in the browser console.
|
|
112
|
+
|
|
113
|
+
To get started, you need to create a new Dinero instance. Amounts are specified in **minor currency units** (e.g.: "cents" for the dollar). You can also specify an [ISO 4217 currency code][wiki:iso-4217] (default is `USD`).
|
|
114
|
+
|
|
115
|
+
This represents β¬50:
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
const price = Dinero({ amount: 5000, currency: 'EUR' })
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
You can add or subtract any amount you want, by passing it another Dinero instance:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
// returns a Dinero object with amount: 5500
|
|
125
|
+
price.add(Dinero({ amount: 500, currency: 'EUR' }))
|
|
126
|
+
|
|
127
|
+
// returns a Dinero object with amount: 4500
|
|
128
|
+
price.subtract(Dinero({ amount: 500, currency: 'EUR' }))
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Dinero.js is immutable, which means you'll always get a new Dinero instance when you perform any kind of transformation on it. Your original instance will remain untouched.
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
price // still returns a Dinero object with amount: 5000
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
All transformative operations return a Dinero instance, so you can chain methods away as you like:
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
// returns a Dinero object with amount: 4000
|
|
141
|
+
Dinero({ amount: 500 })
|
|
142
|
+
.add(Dinero({ amount: 500 }))
|
|
143
|
+
.multiply(4)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Note:** because method calls are executed sequentially, mathematical operator precedence doesn't apply. When you execute the code above, the addition happens before the multiplication, evaluating to `4000`, while `500 + 500 * 4` would normally evaluate to `2500`. If you need to perform an operation before another, make sure you call it first.
|
|
147
|
+
|
|
148
|
+
You can ask all kinds of questions to your Dinero instance. You'll get a `Boolean` in return:
|
|
149
|
+
|
|
150
|
+
```js
|
|
151
|
+
// returns true
|
|
152
|
+
Dinero({ amount: 500 }).equalsTo(Dinero({ amount: 500 }))
|
|
153
|
+
|
|
154
|
+
// returns false
|
|
155
|
+
Dinero({ amount: 100 }).isZero()
|
|
156
|
+
|
|
157
|
+
// returns true
|
|
158
|
+
Dinero({ amount: 1150 }).hasCents()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Because Dinero.js uses `Number.toLocaleString` under the hood, you can display it into any format, for any language. But no need to pass complicated objects of options to format Dinero instances to your liking. Dinero.js works with intuitive `String` masks:
|
|
162
|
+
|
|
163
|
+
```js
|
|
164
|
+
// returns $5.00
|
|
165
|
+
Dinero({ amount: 500 }).toFormat('$0,0.00')
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Just set the locale before you call `toFormat`, and you'll get a display result with the proper format:
|
|
169
|
+
|
|
170
|
+
```js
|
|
171
|
+
// returns 5 000 $US
|
|
172
|
+
Dinero({ amount: 500000 })
|
|
173
|
+
.setLocale('fr-FR')
|
|
174
|
+
.toFormat('$0,0')
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
If you don't want to set the locale all the time, you can also define it globally:
|
|
178
|
+
|
|
179
|
+
```js
|
|
180
|
+
Dinero.globalLocale = 'de-DE'
|
|
181
|
+
|
|
182
|
+
// returns 5.000 $
|
|
183
|
+
Dinero({ amount: 500000 }).toFormat('$0,0')
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
You can still pass a locale to your Dinero instance if you need, which will prevail over the global one. If you use a transformative method on a Dinero object, its local locale will be inherited.
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
// returns 10 $US
|
|
190
|
+
Dinero({ amount: 500 })
|
|
191
|
+
.setLocale('fr-FR')
|
|
192
|
+
.add(Dinero({ amount: 500 }))
|
|
193
|
+
.toFormat('$0,0')
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
By default, new Dinero objects represent monetary values with two decimal places. If you want to represent more, or if you're using a currency with a different [exponent](https://en.wikipedia.org/wiki/ISO_4217#Treatment_of_minor_currency_units_.28the_.22exponent.22.29), you can specify a precision.
|
|
197
|
+
|
|
198
|
+
```js
|
|
199
|
+
// represents $10.545
|
|
200
|
+
Dinero({ amount: 10545, precision: 3 })
|
|
201
|
+
|
|
202
|
+
// The Japanese yen doesn't have sub-units
|
|
203
|
+
// this represents Β₯1
|
|
204
|
+
Dinero({ amount: 1, currency: 'JPY', precision: 0 })
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
If you're using the same currency more than once, it might be worth setting a default precision.
|
|
208
|
+
|
|
209
|
+
```js
|
|
210
|
+
// The Iraqi dinar has up to 3 sub-units
|
|
211
|
+
Dinero.defaultCurrency = 'IQD'
|
|
212
|
+
Dinero.defaultPrecision = 3
|
|
213
|
+
|
|
214
|
+
// represents IQD1
|
|
215
|
+
Dinero({ amount: 1000 })
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This is only a preview of what you can do. Dinero.js has extensive documentation with examples for all of its methods.
|
|
219
|
+
|
|
220
|
+
[Read full documentation][dinero-docs]
|
|
221
|
+
|
|
222
|
+
## Contributing
|
|
223
|
+
|
|
224
|
+
Pull requests are welcome! Please check the [contributing guidelines][dinero-guidelines] for install instructions and general conventions.
|
|
225
|
+
|
|
226
|
+
## Community
|
|
227
|
+
|
|
228
|
+
Selected content about Dinero.js:
|
|
229
|
+
|
|
230
|
+
- [JSJ 351: Dinero.js with Sarah Dayan][community:jsjabber]
|
|
231
|
+
- [Build a Shopping Cart with Vue and Dinero.js][community:shoppingcart]
|
|
232
|
+
- [How to Handle Monetary Values in JavaScript][community:monetaryvalues]
|
|
233
|
+
- [Comparison with Numeral.js][community:numeral]
|
|
234
|
+
- Submit your own blog post/tutorial!
|
|
235
|
+
|
|
236
|
+
## Support
|
|
237
|
+
|
|
238
|
+
Show some love by [upvoting on Product Hunt][producthunt:dinerojs] if you like, support and/or use the library πΌπ
|
|
239
|
+
|
|
240
|
+
## Contributors
|
|
241
|
+
|
|
242
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
243
|
+
<!-- prettier-ignore-start -->
|
|
244
|
+
<!-- markdownlint-disable -->
|
|
245
|
+
<table>
|
|
246
|
+
<tr>
|
|
247
|
+
<td align="center"><a href="https://sarahdayan.dev"><img src="https://avatars1.githubusercontent.com/u/5370675?v=4" width="100px;" alt=""/><br /><sub><b>Sarah Dayan</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=sarahdayan" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=sarahdayan" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/issues?q=author%3Asarahdayan" title="Bug reports">π</a> <a href="#content-sarahdayan" title="Content">π</a> <a href="#blog-sarahdayan" title="Blogposts">π</a> <a href="#ideas-sarahdayan" title="Ideas, Planning, & Feedback">π€</a> <a href="#infra-sarahdayan" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-sarahdayan" title="Maintenance">π§</a> <a href="https://github.com/dinerojs/dinero.js/pulls?q=is%3Apr+reviewed-by%3Asarahdayan" title="Reviewed Pull Requests">π</a> <a href="#question-sarahdayan" title="Answering Questions">π¬</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=sarahdayan" title="Tests">β οΈ</a> <a href="#tutorial-sarahdayan" title="Tutorials">β
</a></td>
|
|
248
|
+
<td align="center"><a href="https://github.com/yacinehmito"><img src="https://avatars1.githubusercontent.com/u/6893840?v=4" width="100px;" alt=""/><br /><sub><b>Yacine Hmito</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=yacinehmito" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=yacinehmito" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=yacinehmito" title="Tests">β οΈ</a></td>
|
|
249
|
+
<td align="center"><a href="https://github.com/scotttrinh"><img src="https://avatars1.githubusercontent.com/u/1682194?v=4" width="100px;" alt=""/><br /><sub><b>Scott Trinh</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=scotttrinh" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=scotttrinh" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=scotttrinh" title="Tests">β οΈ</a> <a href="#ideas-scotttrinh" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
250
|
+
<td align="center"><a href="https://rolandasb.com"><img src="https://avatars0.githubusercontent.com/u/1409998?v=4" width="100px;" alt=""/><br /><sub><b>Rolandas Barysas</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=rolandasb" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=rolandasb" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=rolandasb" title="Tests">β οΈ</a></td>
|
|
251
|
+
<td align="center"><a href="https://www.luizpb.com/en/"><img src="https://avatars1.githubusercontent.com/u/1798830?v=4" width="100px;" alt=""/><br /><sub><b>Luiz "Bills"</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=luizbills" title="Documentation">π</a></td>
|
|
252
|
+
<td align="center"><a href="https://kunst.com.br"><img src="https://avatars2.githubusercontent.com/u/8649362?v=4" width="100px;" alt=""/><br /><sub><b>Leonardo Dino</b></sub></a><br /><a href="#infra-leonardodino" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
|
|
253
|
+
</tr>
|
|
254
|
+
<tr>
|
|
255
|
+
<td align="center"><a href="https://www.kizu.ru/"><img src="https://avatars3.githubusercontent.com/u/177485?v=4" width="100px;" alt=""/><br /><sub><b>Roman Komarov</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=kizu" title="Documentation">π</a></td>
|
|
256
|
+
<td align="center"><a href="http://jotaoncode.com/"><img src="https://avatars3.githubusercontent.com/u/4575026?v=4" width="100px;" alt=""/><br /><sub><b>Juan Garcia</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=jotaoncode" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=jotaoncode" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=jotaoncode" title="Tests">β οΈ</a></td>
|
|
257
|
+
<td align="center"><a href="https://github.com/frobinsonj"><img src="https://avatars3.githubusercontent.com/u/16726902?v=4" width="100px;" alt=""/><br /><sub><b>Freddy Robinson</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=frobinsonj" title="Documentation">π</a></td>
|
|
258
|
+
<td align="center"><a href="https://twitter.com/andybrk"><img src="https://avatars0.githubusercontent.com/u/273857?v=4" width="100px;" alt=""/><br /><sub><b>Andy Burke</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=andyburke" title="Documentation">π</a></td>
|
|
259
|
+
<td align="center"><a href="https://github.com/andrewiggins"><img src="https://avatars3.githubusercontent.com/u/459878?v=4" width="100px;" alt=""/><br /><sub><b>Andre Wiggins</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=andrewiggins" title="Code">π»</a></td>
|
|
260
|
+
<td align="center"><a href="https://desandro.com"><img src="https://avatars0.githubusercontent.com/u/85566?v=4" width="100px;" alt=""/><br /><sub><b>David DeSandro</b></sub></a><br /><a href="#design-desandro" title="Design">π¨</a></td>
|
|
261
|
+
</tr>
|
|
262
|
+
<tr>
|
|
263
|
+
<td align="center"><a href="http://maxk.se"><img src="https://avatars1.githubusercontent.com/u/19932622?v=4" width="100px;" alt=""/><br /><sub><b>Max KΓΆrlinge</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=fongie" title="Documentation">π</a></td>
|
|
264
|
+
<td align="center"><a href="https://github.com/dotpack"><img src="https://avatars2.githubusercontent.com/u/1175814?v=4" width="100px;" alt=""/><br /><sub><b>Ilia Ermolin</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=dotpack" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=dotpack" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=dotpack" title="Tests">β οΈ</a></td>
|
|
265
|
+
<td align="center"><a href="https://coina.ge"><img src="https://avatars1.githubusercontent.com/u/1531750?v=4" width="100px;" alt=""/><br /><sub><b>Kevin Brown</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=thekevinbrown" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=thekevinbrown" title="Tests">β οΈ</a></td>
|
|
266
|
+
<td align="center"><a href="https://seankwalker.com"><img src="https://avatars.githubusercontent.com/u/20524136?v=4" width="100px;" alt=""/><br /><sub><b>Sean Walker</b></sub></a><br /><a href="https://github.com/dinerojs/dinero.js/commits?author=seankwalker" title="Code">π»</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=seankwalker" title="Documentation">π</a> <a href="https://github.com/dinerojs/dinero.js/commits?author=seankwalker" title="Tests">β οΈ</a></td>
|
|
267
|
+
<td align="center"><a href="http://jnguyen.me/"><img src="https://avatars0.githubusercontent.com/u/1127677?v=4" width="100px;" alt=""/><br /><sub><b>John Nguyen</b></sub></a><br /><a href="#infra-nguyenj" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
|
|
268
|
+
</tr>
|
|
269
|
+
</table>
|
|
270
|
+
|
|
271
|
+
<!-- markdownlint-enable -->
|
|
272
|
+
<!-- prettier-ignore-end -->
|
|
273
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
274
|
+
|
|
275
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
|
|
276
|
+
|
|
277
|
+
## Acknowledgements
|
|
278
|
+
|
|
279
|
+
Dinero.js is inspired from [Martin Fowler's monetary representation][fowler-money]. Design-wise, it draws inspiration from [Money PHP][moneyphp], [Luxon][luxon], [Moment.js][moment] and [Numeral.js][numeral] (even though it doesn't rely on any of them).
|
|
280
|
+
|
|
281
|
+
Logo by [David DeSandro][github:desandro].
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
Dinero.js is licensed under [MIT][license].
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
<div align="center">
|
|
290
|
+
|
|
291
|
+
[](https://vercel.com/?utm_source=dinerojs&utm_campaign=oss)
|
|
292
|
+
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
[license]: https://github.com/dinerojs/dinero.js/blob/master/LICENSE.md
|
|
296
|
+
[mdn:intl]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl
|
|
297
|
+
[caniuse:intl]: https://caniuse.com/#feat=internationalization
|
|
298
|
+
[node:full-icu]: https://nodejs.org/api/intl.html#intl_embed_the_entire_icu_full_icu
|
|
299
|
+
[wiki:iso-4217]: https://en.wikipedia.org/wiki/ISO_4217
|
|
300
|
+
[dinero-docs]: https://dinerojs.com/module-dinero
|
|
301
|
+
[dinero-guidelines]: https://github.com/dinerojs/dinero.js/blob/master/CONTRIBUTING.md
|
|
302
|
+
[producthunt:dinerojs]: https://www.producthunt.com/posts/dinero-js
|
|
303
|
+
[fowler-money]: https://martinfowler.com/eaaCatalog/money.html
|
|
304
|
+
[moneyphp]: http://moneyphp.org
|
|
305
|
+
[luxon]: https://moment.github.io/luxon
|
|
306
|
+
[moment]: https://momentjs.com
|
|
307
|
+
[numeral]: http://numeraljs.com
|
|
308
|
+
[npm]: https://www.npmjs.com
|
|
309
|
+
[yarn]: https://yarnpkg.com
|
|
310
|
+
[jsdelivr:landing]: https://www.jsdelivr.com/package/npm/dinero.js
|
|
311
|
+
[jsdelivr:cdn]: https://cdn.jsdelivr.net/npm/dinero.js/build
|
|
312
|
+
[github:desandro]: https://github.com/desandro
|
|
313
|
+
[community:jsjabber]: https://devchat.tv/js-jabber/jsj-351-dinero-js-with-sarah-dayan/
|
|
314
|
+
[community:shoppingcart]: https://frontstuff.io/build-a-shopping-cart-with-vue-and-dinerojs
|
|
315
|
+
[community:monetaryvalues]: https://frontstuff.io/how-to-handle-monetary-values-in-javascript
|
|
316
|
+
[community:numeral]: https://www.reddit.com/r/javascript/comments/84mhrw/dinerojs_an_immutable_library_to_create_calculate/
|