{"id":13834628,"url":"https://github.com/zh/banano-unit-converter","last_synced_at":"2025-04-10T01:32:32.903Z","repository":{"id":42790662,"uuid":"273302772","full_name":"zh/banano-unit-converter","owner":"zh","description":"Converts Banano amounts from one unit to another","archived":false,"fork":false,"pushed_at":"2023-01-07T19:15:43.000Z","size":1154,"stargazers_count":8,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T14:37:56.937Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-18T17:41:50.000Z","updated_at":"2023-02-06T18:22:59.000Z","dependencies_parsed_at":"2023-02-07T22:31:13.463Z","dependency_job_id":null,"html_url":"https://github.com/zh/banano-unit-converter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fbanano-unit-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fbanano-unit-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fbanano-unit-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zh%2Fbanano-unit-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zh","download_url":"https://codeload.github.com/zh/banano-unit-converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248140747,"owners_count":21054345,"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":[],"created_at":"2024-08-04T14:00:48.574Z","updated_at":"2025-04-10T01:32:27.883Z","avatar_url":"https://github.com/zh.png","language":"JavaScript","funding_links":[],"categories":["Client Libraries"],"sub_categories":["JavaScript"],"readme":"# Banano Unit Converter\n\nBanano Unit Converter is a thoroughly-tested library for converting units of the [Banano](https://banano.cc/) cryptocurrency. It supports the conversion of Raw to Banano and Banano to Raw.\n\nThis library code is based on great [nano-unit-converter library](https://github.com/alecrios/nano-unit-converter) by Alec Rios. \n\n## Unit Specifications\n\n**Raw** `10^0` - The smallest unit, commonly used in software code.\n\n**Banano** `10^29` - A human-friendly unit, commonly used in software interfaces.\n\n```\n100000000000000000000000000000 Raw = 1 Banano\n```\n\nNote: In this library, Raw and Banano are referred to as `raw` and `ban`, respectively. This is to avoid casing conflicts between Nano units and coding conventions.\n\n## Installation\n\n```\nnpm install banano-unit-converter\n```\n\n## API\n\n``` ts\n/**\n * Converts ban amount to raw amount.\n *\n * @param {number | string} ban The ban amount.\n *\n * @throws {Error} The ban amount must be defined.\n * @throws {TypeError} The ban amount must be a string or a number.\n * @throws {Error} The ban amount is invalid.\n * @throws {Error} The ban amount must not be negative.\n * @throws {Error} The ban amount is too small.\n * @throws {Error} The ban amount is too large.\n *\n * @returns {string} The raw amount.\n */\nexport declare function banToRaw(ban: number | string): string;\n```\n\n``` ts\n/**\n * Converts raw amount to ban amount.\n *\n * @param {number | string} raw The raw amount.\n *\n * @throws {Error} The raw amount must be defined.\n * @throws {TypeError} The raw amount must be a string or a number.\n * @throws {Error} The raw amount is invalid.\n * @throws {Error} The raw amount must not be negative.\n * @throws {Error} The raw amount is too small.\n * @throws {Error} The raw amount is too large.\n *\n * @returns {string} The ban amount.\n */\nexport declare function rawToBan(raw: number | string): string;\n```\n\n## Examples\n\n```js\nimport { banToRaw, rawToban } from 'nano-unit-converter';\n\nbanToRaw('0.1');                             // '10000000000000000000000000000'\nbanToRaw('1');                               // '100000000000000000000000000000'\nbanToRaw('10');                              // '1000000000000000000000000000000'\n\nrawToban('10000000000000000000000000000')   // '0.1'\nrawToban('100000000000000000000000000000')  // '1'\nrawToban('1000000000000000000000000000000') // '10'\n```\n\n## See Also\n\n- [Nano Unit Converter](https://github.com/alecrios/nano-unit-converter) - Converting units of the Nano cryptocurrency. \n- [Nano Address Validator](https://github.com/alecrios/nano-address-validator) - Validates Nano addresses for syntax and checksum integrity.\n- [Nano URI Generator](https://github.com/alecrios/nano-uri-generator) - Generates Nano URIs for sending amounts, changing representatives, and more.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzh%2Fbanano-unit-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzh%2Fbanano-unit-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzh%2Fbanano-unit-converter/lists"}