{"id":17109943,"url":"https://github.com/oe/numbase","last_synced_at":"2025-10-29T20:10:47.095Z","repository":{"id":35668577,"uuid":"39943842","full_name":"oe/NumBase","owner":"oe","description":"convert a big number with any radix(base), represented with any character","archived":false,"fork":false,"pushed_at":"2016-01-15T06:06:43.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T19:58:26.375Z","etag":null,"topics":["character","decode-number","encode-number","radix"],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","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/oe.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":"2015-07-30T10:01:17.000Z","updated_at":"2019-08-27T09:35:57.000Z","dependencies_parsed_at":"2022-09-08T10:41:33.231Z","dependency_job_id":null,"html_url":"https://github.com/oe/NumBase","commit_stats":null,"previous_names":["evecalm/numbase"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oe/NumBase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oe%2FNumBase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oe%2FNumBase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oe%2FNumBase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oe%2FNumBase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oe","download_url":"https://codeload.github.com/oe/NumBase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oe%2FNumBase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281689354,"owners_count":26544620,"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","status":"online","status_checked_at":"2025-10-29T02:00:06.901Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["character","decode-number","encode-number","radix"],"created_at":"2024-10-14T16:24:54.117Z","updated_at":"2025-10-29T20:10:47.076Z","avatar_url":"https://github.com/oe.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NumBase\nConvert an integer with any base(radix), represented with any character\n\n**You can conver a big number! Yeah, can be super big!**\n\n\n\n## Methods\n\n```js\n// constructor, by default base string will be all alphanumerics (base62)\nNumBase(baseString='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')\n// encode, default base will be the baseString's length\nNumBase::encode(number, base=baseString.length);\n// decode, default base will be the baseString's length\nNumBase::decode(encodedNumber, base=baseString.length);\n```\n\n`NumBase::encode` is something like `Number.prototype.toString`, but it won't limit the base size, and you can revert it with `NumBase::decode`.\n\n## Usage\n\n## for nodejs\ninstall it with npm:\n\n```\nnpm install numbase\n```\n\nthen require it:\n\n```js\nvar Numbase = require('numbase');\n```\n\n\n### for browsers\nYou can include the script with `script` tag, or with amd/cmd(such as requirejs, commonjs ) loaders\n\n### examples\n\n```js\n// Setup an instance with default base string\nvar base = new NumBase();\n// encode a super big number(you must pass it as a string) with default radix 62\nbase.encode('9999999999999999999999999999999999999999999999999999999999999999');\n// returns 'isFUl3RMFVGKeLAbPmHOAA86LLjpGwei1jXh'\n// then decode it with default radix 62\nbase.decode('isFUl3RMFVGKeLAbPmHOAA86LLjpGwei1jXh');\n// returns '9999999999999999999999999999999999999999999999999999999999999999'\n\n\n\n// Setup an instance with custom base string\nbase = new NumBase('中国上海市徐汇区');\n// Encode an integer, use default radix 8\nbase.encode(19901230); // returns '国国海区上徐市徐汇'\n// Decode a string, with default radix 8\nbase.decode('国国海区上徐市徐汇'); // returns '19901230'\n\n// Encode an integer, with radix 7\nbase.encode(19901230, 7); // returns '海海国国中徐中海汇'\n// Decode a string, with radix 7\nbase.decode('海海国国中徐中海汇', 7); // returns '19901230'\n\n\n\n// And there is some thing else!\n// setup an instance with common letters used in articles\nbase = new NumBase('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?_+= %\u0026*()#@!$\\',;.');\n// then encode your words(like lover letters), encode it into numbers!\n// you should use decode to encode your words, strange?\nbase.decode('The furthest distance in the world, is not between life and death. But when I stand in front of you,Yet you don\\'t know that I love you!');\n// returns '57031381561275606392394756616992749156901193715383571159265195685821406415964188213571176381421833854362042612855929981904540567614578869806954870724353288627661399322034962143689960167076321231141725990698446223883841721866243690267975268687767453140124074'\n// and when decode the numbers, people will see the truth\n// use encode to decode numbers to words\nbase.encode('57031381561275606392394756616992749156901193715383571159265195685821406415964188213571176381421833854362042612855929981904540567614578869806954870724353288627661399322034962143689960167076321231141725990698446223883841721866243690267975268687767453140124074');\n// returns \"The furthest distance in the world, is not between life and death. But when I stand in front of you,Yet you don't know that I love you!\"\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foe%2Fnumbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foe%2Fnumbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foe%2Fnumbase/lists"}