Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tim-evans/maguire.js
A small client-side library that works in conjunction with maguire to format money.
https://github.com/tim-evans/maguire.js
Last synced: 10 days ago
JSON representation
A small client-side library that works in conjunction with maguire to format money.
- Host: GitHub
- URL: https://github.com/tim-evans/maguire.js
- Owner: tim-evans
- License: mit
- Created: 2015-04-21T17:38:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-01-09T20:03:44.000Z (almost 10 years ago)
- Last Synced: 2024-10-18T08:28:46.798Z (19 days ago)
- Language: JavaScript
- Size: 266 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Maguire.js
A small client-side library that works in conjunction with maguire to format money.
### Configuring the library
Maguire.js doesn't come with any locale / currency support by default. It's designed to get data from your server tailored to the needs of the specific end user.
If maguire.js is being used in conjunction with maguire for Ruby, the following snippit should do the trick:
```javascript
var maguire = require('maguire');// Register currencies for this user
$.getJSON('/currencies', function (currencies) {
currencies.forEach(maguire.registerCurrency);
});$.getJSON('/locale', function (locale) {
maguire.registerLocale(locale.id, locale);
});
```### Formatting
Once configured, you may start formatting your money:
```javascript
var format = require('maguire').format;format({ value: 2000, currency: 'USD' });
// => $20.00
```