- Notifications
You must be signed in to change notification settings - Fork0
Create, calculate and format money in Nim language (WIP)
License
openpeeps/money
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Create, calculate and format money in 👑 Nim language.
nimble install money
Nim library to make working with money safer, easier and fun!
If I had a dime for every time I've seen someone use FLOAT to store currency, I'd have $999.997634 -- Bill Karwin
- Framework agnostic
- Works with BigInts via
pkg/bigints
- Math Operations
+
,-
,*
,/
- Math Operations (mutable)
+=
-=
,*=
,/=
=>add
,sub
,multi
,div
- Money Formatting (including intl formatter)
- Money Exchange using 3rd party providers
UsedefaultCurrency
option to change the default currency at compile-time. Example-d:defaultCurrency:49
(default) forEURO
import moneyassert$(fmt("150"))=="EUR 1.50"assert2500.EUR== fmt"2500"# EUR 25.50
var x= amount("150", EUR) y= amount("150", EUR)assert x+ y==300.EUR# EUR 3.00x+= yassert x==300.EUR# EUR 3.00assert x+ y> y# EUR 3.00 > EUR 1.50
var x= fmt("100")assert$(x- fmt(50))=="EUR 0.50"
Comparingx
toy
is easy!
var x=100.EUR y=150.EURassert x==100.EURassert x< yassert x>=99.EURassert x!=100.USDassert y> xassert y>=149.EUR
Dummy cart example available in/tests
- 🐛 Found a bug?Create a new Issue
- 👋 Wanna help?Fork it!
- 😎Get €20 in cloud credits from Hetzner
This library is inspired frommoneyphp/money.
Money | MIT license.Made by Humans from OpenPeeps for Supranim
Copyright © OpenPeeps & Contributors — All rights reserved.
About
Create, calculate and format money in Nim language (WIP)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.