{"id":20645110,"url":"https://github.com/jesusgraterol/bignumber-utils","last_synced_at":"2026-01-30T08:13:36.893Z","repository":{"id":243088976,"uuid":"811411969","full_name":"jesusgraterol/bignumber-utils","owner":"jesusgraterol","description":"The bignumber-utils package empowers developers to effortlessly perform accurate and reliable decimal and non-decimal arithmetic in JavaScript, leveraging the robust foundation of the bignumber.js library.","archived":false,"fork":false,"pushed_at":"2025-07-17T21:58:27.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-20T20:49:53.780Z","etag":null,"topics":["accuracy","arithmetics","bignumber","calculator","decimals","number","number-management","numbers","precision","utilities","utils"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/bignumber-utils","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/jesusgraterol.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-06T14:47:41.000Z","updated_at":"2025-07-17T21:58:10.000Z","dependencies_parsed_at":"2024-06-25T18:43:54.407Z","dependency_job_id":"8430a585-4a59-4c46-9151-38e09ae769f8","html_url":"https://github.com/jesusgraterol/bignumber-utils","commit_stats":null,"previous_names":["jesusgraterol/bignumber-utils"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jesusgraterol/bignumber-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fbignumber-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fbignumber-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fbignumber-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fbignumber-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesusgraterol","download_url":"https://codeload.github.com/jesusgraterol/bignumber-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusgraterol%2Fbignumber-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28909154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T06:42:00.998Z","status":"ssl_error","status_checked_at":"2026-01-30T06:41:58.659Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["accuracy","arithmetics","bignumber","calculator","decimals","number","number-management","numbers","precision","utilities","utils"],"created_at":"2024-11-16T16:18:44.656Z","updated_at":"2026-01-30T08:13:36.888Z","avatar_url":"https://github.com/jesusgraterol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BigNumber Utils\n\nThe `bignumber-utils` package empowers developers to effortlessly perform accurate and reliable decimal and non-decimal arithmetic in JavaScript, leveraging the robust foundation of the [bignumber.js](https://github.com/MikeMcl/bignumber.js) library.\n\nThis package provides a streamlined interface for working with arbitrary-precision numbers, eliminating the limitations and potential inaccuracies associated with standard JavaScript number representation. With `bignumber-utils`, you can confidently handle complex calculations, financial transactions, scientific computations, and more, ensuring precise results every time.\n\n\n\n\u003c/br\u003e\n\n## Getting Started\n\nInstall the package:\n```bash\nnpm i -S bignumber-utils\n```\n\n### Examples\n\nHandle and format large numeric values with ease:\n```typescript\nimport { getBigNumber, prettifyValue } from 'bignumber-utils';\n\nlet value = getBigNumber('1456550199.54631546987123654159');\n\nvalue = processValue(value, { \n  decimalPlaces: 18, \n  roundingMode: 'ROUND_HALF_UP',\n  type: 'string'\n});\n// '1456550199.546315469871236542'\n\nprettifyValue(value, { format: { prefix: '$' } });\n// '$1,456,550,199.55'\n\nprettifyValue(value, { \n  processing: {\n    decimalPlaces: 8,\n    roundingMode: 'ROUND_HALF_DOWN'\n  },\n  format: { \n    groupSeparator: '.', \n    decimalSeparator: ',',\n    suffix: ' BTC'\n  } \n});\n// '1.456.550.199,54631547 BTC'\n```\n\nLeverage the utility functions provided by this package:\n```typescript\nimport { getBigNumber, calculateSum, adjustByPercentage } from 'bignumber-utils';\n\ncalculateSum(\n  [1, 86, '55', 46.33, '47.55', getBigNumber(8041.663321), 485, '99.11', getBigNumber(-800.654)]\n);\n// 8061\n\nadjustByPercentage(56936.63, -35); // 37008.81\n```\n\nAccess the full `bignumber.js` API directly using the getBigNumber function when needed for advanced operations:\n```typescript\nimport { getBigNumber, processValue } from 'bignumber-utils';\n\nconst result = getBigNumber(14513.622145123884031).dividedBy(655.1232);\nprocessValue(result,  { decimalPlaces: 18, type: 'bignumber' });\n// BigNumber(22.154034760368558158)\n```\n\n\n\u003c/br\u003e\n\n## API Reference\n\n### Value Processors\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003egetBigNumber\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n\n  Instantiates `BigNumber` from a valid numeric value.\n  \n  ```typescript\n  import { BigNumber } from 'bignumber.js';\n  import { getBigNumber } from 'bignumber-utils';\n\n  getBigNumber(355).dividedBy(113).toString();\n  getBigNumber('355').dividedBy(113).toString();\n  getBigNumber(BigNumber(355)).dividedBy(113).toString();\n  // '3.14159292035398230088'\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eprocessValue\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Processes and outputs a value to match the requirements specified in the configuration (if any).\n\n  ```typescript\n  import { processValue } from 'bignumber-utils';\n\n  processValue(100.585) // 100.59\n  processValue(110.55, { type: 'number' }) // 110.55\n  processValue(110.55, { type: 'string', decimalPlaces: 1 }) // '110.6'\n  processValue(110.55, { type: 'bignumber' }) // BigNumber(100.55)\n  processValue(512.155, { roundingMode: 'ROUND_CEIL' }) // 513\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eprettifyValue\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Generates the string representation of a value after being processed and formatted to match the requirements specified in the configuration (if any).\n  \n  ```typescript\n  import { prettifyValue } from 'bignumber-utils';\n\n  prettifyValue(\n    15426525.846545124, \n    { \n      processing: { \n        decimalPlaces: 8 \n      }, \n      format: { \n        prefix: 'BTC ' \n      } \n    }\n  ); \n  // 'BTC 15,426,525.84654512'\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n\n\n\n### Helpers\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eisBigNumber\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Verifies if the value is a `BigNumber` Instance.\n\n  ```typescript\n  import { isBigNumber, getBigNumber } from 'bignumber-utils';\n\n  isBigNumber(getBigNumber(123)); // true\n  isBigNumber(123); // false\n  isBigNumber('123'); // false\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eisNumber\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Verifies if the value is a `number` in any of the supported types (`IBigNumberValue`).\n\n  ```typescript\n  import { isNumber, getBigNumber } from 'bignumber-utils';\n\n  isNumber(NaN); // false\n  isNumber(getBigNumber(123)); // true\n  isNumber(123); // true\n  isNumber('123'); // true\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eisInteger\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Verifies if the value is an `integer` in any of the supported types (`IBigNumberValue`).\n\n  ```typescript\n  import { isInteger, getBigNumber } from 'bignumber-utils';\n\n  isInteger(getBigNumber(123)); // true\n  isInteger(getBigNumber(123.551)); // false\n  isInteger(54122); // true\n  isInteger('241.44332'); // false\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eisFloat\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Verifies if the value is a `float` in any of the supported types (`IBigNumberValue`).\n\n  ```typescript\n  import { isInteger, getBigNumber } from 'bignumber-utils';\n\n  isFloat(getBigNumber(123)); // false\n  isFloat(getBigNumber(123.551)); // true\n  isFloat(54122); // false\n  isFloat('241.44332'); // true\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n\n\n\n### Essential Calculations\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateSum\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the sum for an array of values. It returns 0 if the array is empty.\n\n  ```typescript\n  import { calculateSum, getBigNumber } from 'bignumber-utils';\n\n  calculateSum([1, 86, '55', 46.33, '47.55', getBigNumber(8041.663321), 485, '99.11', getBigNumber(-800.654)]); \n  // 8061\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateMin\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Identifies the smallest value in an array. It returns 0 if the array is empty.\n\n  ```typescript\n  import { calculateMin, getBigNumber } from 'bignumber-utils';\n\n  calculateMin([1, 86, '55', 46.33, '47.55', getBigNumber(8041.663321), 485, '99.11', getBigNumber(-800.654)]); \n  // -800.65\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateMax\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Identifies the largest value in an array. It returns 0 if the array is empty.\n\n  ```typescript\n  import { calculateMax, getBigNumber } from 'bignumber-utils';\n\n  calculateMax([1, 86, '55', 46.33, '47.55', getBigNumber(8041.663321), 485, '99.11', getBigNumber(-800.654)]); \n  // 8041.66\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateMean\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the mean for an array of values. It returns 0 if the array is empty.\n\n  ```typescript\n  import { calculateMean, getBigNumber } from 'bignumber-utils';\n\n  calculateMean([1, 86, '55', 46.33, '47.55', getBigNumber(8041.663321), 485, '99.11', getBigNumber(-800.654)]); \n  // 895.67\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateMedian\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the median for an array of values. It returns 0 if the array is empty.\n\n  ```typescript\n  import { calculateMedian, getBigNumber } from 'bignumber-utils';\n\n  calculateMedian([1093.55, '711.41', getBigNumber(987.13), 342, '654.99', getBigNumber(84.32), '-55.99', 25132.33,]); \n  // 683.2\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n\n\n\n\n### Percentage Calculations\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculatePercentageChange\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the percentage change experienced by a value. Note that if the value increased, the change will be positive. Otherwise, it will be negative. If there was no change, it returns 0. Moreover, the largest decrease supported by this library is -100%. If newValue is less than or equal to 0, -100 will be returned.\n\n  ```typescript\n  import { calculatePercentageChange } from 'bignumber-utils';\n\n  calculatePercentageChange(100, 150); // 50\n  calculatePercentageChange(1555.6544122, 554366.123124); // 35535.56\n  calculatePercentageChange(745.655, 1225.446, { decimalPlaces: 4 }); // 64.3449\n  calculatePercentageChange(\n    '5412151.54561245487451',\n    '78998154125.6632113',\n    { decimalPlaces: 10, type: 'string' },\n  ); \n  // '1459544.1629522691'\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eadjustByPercentage\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Changes a value by a percentage. If the % is positive, it increases the value. Otherwise, it decreases it.\n\n  ```typescript\n  import { adjustByPercentage, getBigNumber } from 'bignumber-utils';\n\n  adjustByPercentage(100, 50); // 150\n  adjustByPercentage(100, -50); // 50\n  adjustByPercentage(57700, 1); // 58277\n  adjustByPercentage('12.536', getBigNumber(-0.00797703), { decimalPlaces: 3 }); // 12.535\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculatePercentageRepresentation\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Changes a value by a percentage. If the % is positive, it increases the value. Otherwise, it decreases it.\n\n  ```typescript\n  import { calculatePercentageRepresentation } from 'bignumber-utils';\n\n  calculatePercentageRepresentation(50, 100); // 50\n  calculatePercentageRepresentation(100, 1000); // 10\n  calculatePercentageRepresentation(50, 75, { decimalPlaces: 3 }) // 66.667\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n\n\n\n\n### Financial Calculations\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateExchange\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the asset amount that will be received once the exchange executes.\n  - Example: calculateExchange(value = 100 USDT, rate = 65000 USDT/BTC) =\u003e 0.00154 BTC\n\n  ```typescript\n  import { calculateExchange } from 'bignumber-utils';\n\n  calculateExchange(100, 65000, { decimalPlaces: 5 }); // 0.00154\n  calculateExchange(158794.2755, 64813.99); // 2.45\n  calculateExchange(0.08970286, 0.05409, { decimalPlaces: 4 }); // 1.6584\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateExchangeFee\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the fee amount that will be charged when executing a currency exchange based on a percentage.\n\n  ```typescript\n  import { calculateExchangeFee } from 'bignumber-utils';\n\n  calculateExchangeFee(1000, 1); // 10\n  calculateExchangeFee(25.2774561, 0.075, { decimalPlaces: 8 }); // 0.01895809\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003ecalculateWeightedEntry\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  Calculates the weighted average trade price when a position can have several entries at different prices for different amounts. If the array is empty, it returns 0. \n  \n  Important: the trades' tuples must follow: `[price, amount]`.\n\n  ```typescript\n  import { calculateWeightedEntry } from 'bignumber-utils';\n\n  calculateWeightedEntry([\n    [15699.65, 0.13562],\n    [15500.32, 0.24210],\n    [16665.88, 0.16644],\n    [19555.11, 0.2886],\n    [24655.44, 0.16665],\n    [22113.65, 0.2001],\n    [28966.11, 0.13661],\n    [33154.24, 0.1774],\n    [36764.81, 0.266],\n    [32145.46, 0.18546],\n  ]);\n  // 24637.82\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n### BigNumber API\n\nSince this library is built on top of `bignumber.js`, whenever you invoke `getBigNumber(value)` or `buildNumber(value, { buildType: 'bignumber' })` you can make use of any method within the BigNumber Instance. \n\nThe list of methods can be found [here](https://mikemcl.github.io/bignumber.js/).\n\n\n\n\n\n\u003cbr/\u003e\n\n## Types\n\n### BigNumber\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIBigNumber\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  The instance of a BigNumber. It can be generated via the constructor `new BigNumber(value)` or by simply invoking it as a function `BigNumber(value)`. When using this library, it can be generated via the `getBigNumber(value)` function.\n\n  ```typescript\n  import { BigNumber } from 'bignumber.js';\n\n  type IBigNumber = BigNumber;\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIBigNumberRoundingModeName\u003c/code\u003e \u0026 \u003ccode\u003eIBigNumberRoundingMode\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  The type of rounding that will be used when processing a value. The supported modes are:\n  - **ROUND_UP(0):** rounds away from zero\n  - **ROUND_DOWN(1):** rounds towards zero\n  - **ROUND_CEIL(2):** rounds towards Infinity\n  - **ROUND_FLOOR(3):** rounds towards -Infinity\n  - **ROUND_HALF_UP(4)*:** rounds towards nearest neighbour. If equidistant, rounds away from zero (Default)\n  - **ROUND_HALF_DOWN(5):** rounds towards nearest neighbour. If equidistant, rounds towards zero\n  - **ROUND_HALF_EVEN(6):** rounds towards nearest neighbour. If equidistant, rounds towards even neighbour\n  - **ROUND_HALF_CEIL(7):** rounds towards nearest neighbour. If equidistant, rounds towards Infinity\n  - **ROUND_HALF_FLOOR(8):** rounds towards nearest neighbour. If equidistant, rounds towards -Infinity\n\n  ```typescript\n  type IBigNumberRoundingModeName = 'ROUND_UP' | 'ROUND_DOWN' | 'ROUND_CEIL' | 'ROUND_FLOOR' | 'ROUND_HALF_UP' | 'ROUND_HALF_DOWN' | 'ROUND_HALF_EVEN' | 'ROUND_HALF_CEIL' | 'ROUND_HALF_FLOOR';\n\n  type IBigNumberRoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;\n  ```\n\n  \u003cbr/\u003e\n\n  More information:\n  - https://mikemcl.github.io/bignumber.js/#rounding-mode\n  - https://mikemcl.github.io/bignumber.js/#constructor-properties\n\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIBigNumberValue\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  The types that can be used to instantiate BigNumber. Moreover, any of these types can be obtained when processing a value by setting it in the configuration object (`type` prop).\n\n  ```typescript\n  type IBigNumberValue = string | number | BigNumber;\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIBigNumberFormat\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  The configuration object that is applied to the toFormat method which is used to prettify values.\n  Available settings are:\n  - **prefix:** string to prepend. Default: `''`\n  - **decimalSeparator:** decimal separator. Default: `'.'`\n  - **groupSeparator:** grouping separator of the integer part. Default: `','`\n  - **groupSize:** primary grouping size of the integer part. Default: `3`\n  - **secondaryGroupSize:** secondary grouping size of the integer part. Default: `0`\n  - **fractionGroupSeparator:** grouping separator of the fraction part. Default: `' '`\n  - **fractionGroupSize:** grouping size of the fraction part. Default: `0`\n  - **suffix:** string to append\n\n  ```typescript\n  type IBigNumberFormat = {\n    prefix?: string;\n    decimalSeparator?: string;\n    groupSeparator?: string;\n    groupSize?: number;\n    secondaryGroupSize?: number;\n    fractionGroupSeparator?: string;\n    fractionGroupSize?: number;\n    suffix?: string;\n  };\n  ```\n\n  \u003cbr/\u003e\n\n  More information:\n  - https://mikemcl.github.io/bignumber.js/#\n\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n### General\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIType\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  When a value is processed, it can output an IBigNumberValue type in order to meet the project's requirements and overcome JavaScript's numeric limitations.\n\n  ```typescript\n  type IType = 'string' | 'number' | 'bignumber';\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIConfig\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  The configuration that will be used to process a value.\n\n  ```typescript\n  type IConfig = {\n    // the maximum number of decimals that will be present in the output\n    decimalPlaces: number; // Default: 2\n\n    // determines how the value will be rounded (in case it has decimals)\n    roundingMode: IBigNumberRoundingModeName; // Default: 'ROUND_HALF_UP'\n\n    // the output's type\n    type: IType; // Default: 'number'\n  };\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003ccode\u003eIOutput\u003cT\u003e\u003c/code\u003e\u003c/summary\u003e\n  \u003c/br\u003e\n  \n  A generic type that sets the return type for the function that processes value based on the provided configuration (type prop).\n\n  ```typescript\n  type IOutput\u003cT\u003e =\n    T extends { type: 'string' } ? string\n      : T extends { type: 'number' } ? number\n        : T extends { type: 'bignumber' } ? IBigNumber\n          : number;\n  ```\n  \u003c/br\u003e\n\u003c/details\u003e\n\n\n\n\n\u003cbr/\u003e\n\n## Built With\n\n- TypeScript\n\n\n\n\n\u003cbr/\u003e\n\n## Running the Tests\n\n```bash\nnpm run test:unit\n```\n\n\n\n\n\n\u003cbr/\u003e\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusgraterol%2Fbignumber-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesusgraterol%2Fbignumber-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusgraterol%2Fbignumber-utils/lists"}