{"id":18785734,"url":"https://github.com/uzyn/bigdenary","last_synced_at":"2025-04-13T12:34:09.443Z","repository":{"id":57189617,"uuid":"273637402","full_name":"uzyn/bigdenary","owner":"uzyn","description":"🦕🧮 Arbitrary-length decimal library, implemented with ES2020's native BigInt.","archived":false,"fork":false,"pushed_at":"2020-08-20T12:19:53.000Z","size":77,"stargazers_count":11,"open_issues_count":3,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-31T13:53:01.121Z","etag":null,"topics":["bigdecimal","bigdecimals","bigint","bignum","bignumber","decimal","decimals","deno","es6","es6-module","esm","esmodule","javascript","no-dependencies","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/bigdenary","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uzyn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-20T04:22:47.000Z","updated_at":"2023-05-05T04:08:11.000Z","dependencies_parsed_at":"2022-09-15T06:01:52.511Z","dependency_job_id":null,"html_url":"https://github.com/uzyn/bigdenary","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uzyn%2Fbigdenary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uzyn%2Fbigdenary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uzyn%2Fbigdenary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uzyn%2Fbigdenary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uzyn","download_url":"https://codeload.github.com/uzyn/bigdenary/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223589143,"owners_count":17169891,"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":["bigdecimal","bigdecimals","bigint","bignum","bignumber","decimal","decimals","deno","es6","es6-module","esm","esmodule","javascript","no-dependencies","typescript"],"created_at":"2024-11-07T20:49:32.920Z","updated_at":"2024-11-07T20:49:33.572Z","avatar_url":"https://github.com/uzyn.png","language":"TypeScript","readme":"BigDenary\n----\nArbitrary-length decimal implementation using JavaScript's native [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) with no dependencies.\n\n- Supported on Node \u003e= 10.4 and Deno.\n- Check [caniuse.com](https://caniuse.com/#search=bigint) for browser support.\n\n### Features\n\n- [Deno](https://deno.land) module first. Soon to be available as ES Module (ESM) and CommonJS (Node) module.\n\n- Compute methods are largely implemented through native BigInt, without much string manipulation required.\n\n- Standalone \u0026 lightweight. Zero dependencies.\n\n- Intuitive data structure – base amount and decimal places, similar to that of cryptocurrency esp. Bitcoin.\n\n- API is similar with the popular BigNumber libraries such as bignumber.js, big.js, decimal.js. Not all methods are supported, yet.\n\n## Usage\n\n```ts\nimport { BigDenary } from \"https://deno.land/x/bigdenary/mod.ts\";\n\nconst bd = new BigDenary(\"123.4512\");\nconst sum = bd.add(56.1e2);\n\nconsole.log(sum.toString()); // 5733.4512\nconsole.log(sum); // BigDenary { base: 57334512n, _decimals: 4 }\n```\n\nAPI is largely inspired by and attempts to be compatible with [`decimal.js-light`](https://github.com/MikeMcl/decimal.js-light).\n\n### Available API\n\n#### Core\n- `constructor()`: supports `type BDNumberInput = number | string | bigint | BigDenary | BigDenaryRaw`.\n- `toString()`: Returns `string` representation\n- `valueOf()`: Returns `number` approximation\n- `toFixed(digits?)`: Returns `string` representation to the number of `digits` to appear decimal point.\n\n#### Operations\n- `plus()` or `add()`\n- `minus()` or `sub()`\n- `multipliedBy()` or `mul()`\n- `dividedBy()` or `div()`\n- `negated()` or `neg()`\n- `absoluteValue()` or `abs()`\n\n#### Comparisons\n- `comparedTo()` or `cmp()`\n- `equals()` or `eq()`\n- `greaterThan()` or `gt()`\n- `greaterThanOrEqualTo()` or `gte()`\n- `lessThan()` or `lt()`\n- `lessThanOrEqualTo()` or `lte()`\n\n## Develop and running of tests\n\n1. Install [Deno](http://deno.land)\n\n2. Run unit tests\n\n  ```bash\n  deno test\n  ```\n\n## Notes\n\nJavaScript native decimal support is currently [being proposed](https://github.com/tc39/proposal-decimal) (Stage 1) to ECMA.\n\n## License\n\nMIT \u0026middot; [U-Zyn Chua](https://zynesis.com)\n\nContributions are welcomed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuzyn%2Fbigdenary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuzyn%2Fbigdenary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuzyn%2Fbigdenary/lists"}