{"id":17942494,"url":"https://github.com/marchdev-tk/mdamount","last_synced_at":"2025-04-03T13:27:27.750Z","repository":{"id":259501101,"uuid":"878031160","full_name":"marchdev-tk/mdamount","owner":"marchdev-tk","description":"march.dev amount library. Provides a new way to work with an amount. From highly flexible creation to rich data manipulation and stringification options.","archived":false,"fork":false,"pushed_at":"2025-03-11T14:37:08.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-11T15:45:45.946Z","etag":null,"topics":["amount","dart","dart-console","dart-package","dart3","dartlang","decimal","flutter","flutter-desktop","flutter-mobile","flutter-package","flutter-web"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marchdev-tk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-24T16:51:58.000Z","updated_at":"2025-03-11T14:37:06.000Z","dependencies_parsed_at":"2025-01-16T12:20:14.127Z","dependency_job_id":"5046300e-b9d2-4ffd-9ba0-2340d0622692","html_url":"https://github.com/marchdev-tk/mdamount","commit_stats":null,"previous_names":["marchdev-tk/mdamount"],"tags_count":10,"template":false,"template_full_name":"marchdev-tk/dart_package_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fmdamount","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fmdamount/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fmdamount/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fmdamount/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marchdev-tk","download_url":"https://codeload.github.com/marchdev-tk/mdamount/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247008706,"owners_count":20868414,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amount","dart","dart-console","dart-package","dart3","dartlang","decimal","flutter","flutter-desktop","flutter-mobile","flutter-package","flutter-web"],"created_at":"2024-10-29T03:05:49.664Z","updated_at":"2025-04-03T13:27:27.707Z","avatar_url":"https://github.com/marchdev-tk.png","language":"Dart","readme":"# mdamount\n\n![Build](https://github.com/marchdev-tk/mdamount/workflows/build/badge.svg)\n[![codecov](https://codecov.io/gh/marchdev-tk/mdamount/branch/master/graph/badge.svg)](https://codecov.io/gh/marchdev-tk/mdamount)\n[![Pub](https://img.shields.io/pub/v/mdamount.svg)](https://pub.dartlang.org/packages/mdamount)\n![GitHub](https://img.shields.io/github/license/marchdev-tk/mdamount)\n![GitHub stars](https://img.shields.io/github/stars/marchdev-tk/mdamount?style=social)\n\nmarch.dev amount library. Provides a new way to work with an amount. From highly flexible creation to rich data manipulation and stringification options.\n\n## Getting Started\n\n### Construction\n\nTo begin your work with a money object you need to create it, there are several ways to do it:\n\n  * `Amount` with following args:\n    * `BigInt` numerator\n    * custom `precision`, if not provided or if negative precision was set - `Amount.defaultPrecision` will be used instead\n  * `Amount.fromNumerator` with following args:\n    * `int` numerator\n    * custom `precision`, if not provided - `Amount.defaultPrecision` will be used instead\n  * `Amount.fromBigInt` with following args:\n    * `BigInt` amount\n    * custom `precision`, if not provided - `Amount.defaultPrecision` will be used instead\n  * `Amount.fromInt` with following args:\n    * `int` amount\n    * custom `precision`, if not provided - `Amount.defaultPrecision` will be used instead\n  * `Amount.fromDecimal` with following args:\n    * `Decimal` amount (from `decimal` package)\n    * custom `precision`, if not provided - `Amount.defaultPrecision` will be used instead\n  * `Amount.fromDouble` with following args:\n    * `double` amount\n    * custom `precision`, if not provided - `Amount.defaultPrecision` will be used instead\n  * `Amount.fromString` with following args:\n    * `String`\n    * custom `precision`, if not provided - `Amount.defaultPrecision` will be used instead\n\nAlso there are some convenient ways to create an object:\n\n  * `Amount.zeroOf` to create the amount with `0` as numerator with custom `precision`\n  * `Amount.oneOf` to create the amount with `1` as numerator with custom `precision`\n  * `Amount.oneIntOf` to create the amount with `1` as integer with custom `precision`\n  * `Amount.zero` to create the amount with `0` as numerator with default precision (`Amount.defaultPrecision`)\n  * `Amount.one` to create the amount with `1` as numerator with default precision (`Amount.defaultPrecision`)\n  * `Amount.oneInt` to create the amount with `1` as integer with default precision (`Amount.defaultPrecision`)\n\n### Manipulation\n\nFirst of all, `Amount` object is `comparable` and has all required operators:\n  * unary `operator -`\n  * binary `operator -`\n  * `operator +`\n  * `operator *`\n  * `operator /`\n  * `operator \u003c`\n  * `operator \u003c=`\n  * `operator \u003e`\n  * `operator \u003e=`\n  * `operator ==`\n\nRegarding what you can do with this object, let's break down following methods/getters/fields:\n  \n  * `cents` - returns the `BigInt` `cents` representation of the amount \n  * `currency` - returns the `currency` of the amount\n  * `precision` - returns the `precision` of the amount (quantity of digits in fractional part)\n  * `sign` - returns the `sign` of the amount\n  * `isEven` - whether the amount is `even` or not\n  * `isOdd` - whether the amount is `odd` or not\n  * `isNegative` - whether the amount is `negative` or not\n  * `isPositive` - whether the amount is `positive` or not\n  * `isZero` - whether the amount is equals to `zero` or not\n  * `isGreaterThanZero` - whether the amount is greater than `zero` or not\n  * `isGreaterThanOrEqualZero` - whether the amount is greater than or equals to `zero` or not\n  * `isLessThanZero` - whether the amount is less than `zero` or not\n  * `isLessThanOrEqualZero` - whether the amount is less than or equals to `zero` or not\n  * `integer` - returns the `integer` part of the amount\n  * `fractional` - returns the `fractional` part of the amount in `BigInt` cents\n  * `fractionalDecimal` - returns the `fractional` part of the amount in `Decimal`\n  * `fractionalDouble` - returns the `fractional` part of the amount in `double`\n  * `toDecimal` - returns the amount in `Decimal`\n  * `toDouble` - returns theamount in `double`\n  * `abs` - returns the `absolute` (always positive) amount\n  * `round` - returns the `rounded` amount\n  * `ceil` - returns the `ceiled` amount (rounded to the next integer)\n  * `floor` - returns the `floored` amount (truncating fractional part of the amount)\n  * `toString` - return the `String` representation of the amount with lots of customisation options, they are:\n    * `DecimalSeparatorFormat` - specifies which decimal separator to use:\n      * `point`\n      * `comma` \n    * `RankFormat` - specifies rank formatting:\n      * `none` (`XXXX`)\n      * `space` (`X XXX`)\n    * `AmountFormat` - specifies amount display formatting:\n      * `integer` - only integer part (`XXXX`)\n      * `fixedDouble` - fractional parts will display full precision, even zeros (`XXXX.XX`)\n      * `flexibleDouble` - fractional parts will not display trailing zeros (`XXXX`/`XXXX.X`/`XXXX.XX`)\n    * `precision` - if set, this method will behave differently based on `AmountFormat`:\n      * `integer` - `precision` is omitted\n      * `fixedDouble` - `precision` will be used as an override to `Amount.precision`\n      * `flexibleDouble` - `precision` will be used only if length of fractionals will be less than `precision`\n\n### Changing or accessing default precision\n\nTo access default precision use following static getter:\n  * `Amount.defaultPrecision`\n\nAnd for changing default precision use following static method:\n  * `Amount.setDefaultPrecision(\u003cnew_precision\u003e)`\n\nBut be cautious, precision cannot be less than zero.\n\n### Known limitations\n\n  * Max precision is `15`, everything that is beyond this precision will be trimmed due to Decimal's internal inability to work with such precisions.\n\n## Examples\n\nTo see usage example navigate to the [Example](example/README.md) section.\n\n## Feature requests and Bug reports\n\nFeel free to post a feature requests or report a bug [here](https://github.com/marchdev-tk/mdamount/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarchdev-tk%2Fmdamount","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarchdev-tk%2Fmdamount","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarchdev-tk%2Fmdamount/lists"}