{"id":25360466,"url":"https://github.com/r48n34/chinese-commercial-code-convertor","last_synced_at":"2026-02-14T20:35:23.151Z","repository":{"id":277322862,"uuid":"932035465","full_name":"r48n34/chinese-commercial-code-convertor","owner":"r48n34","description":"Simple Typescript code for convert Chinese Commercial Code.","archived":false,"fork":false,"pushed_at":"2026-02-13T10:13:45.000Z","size":370,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-13T19:13:43.248Z","etag":null,"topics":["ccc","npm"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/chinese-commercial-code-convertor","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/r48n34.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":"2025-02-13T09:02:36.000Z","updated_at":"2026-02-13T10:13:48.000Z","dependencies_parsed_at":"2025-07-08T01:20:33.212Z","dependency_job_id":"a68c91ff-3e3a-4710-935f-7570cc8127fc","html_url":"https://github.com/r48n34/chinese-commercial-code-convertor","commit_stats":null,"previous_names":["r48n34/chinese-commercial-code-convertor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/r48n34/chinese-commercial-code-convertor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r48n34%2Fchinese-commercial-code-convertor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r48n34%2Fchinese-commercial-code-convertor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r48n34%2Fchinese-commercial-code-convertor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r48n34%2Fchinese-commercial-code-convertor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r48n34","download_url":"https://codeload.github.com/r48n34/chinese-commercial-code-convertor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r48n34%2Fchinese-commercial-code-convertor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29455358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T15:52:44.973Z","status":"ssl_error","status_checked_at":"2026-02-14T15:52:11.208Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["ccc","npm"],"created_at":"2025-02-14T21:40:47.069Z","updated_at":"2026-02-14T20:35:23.137Z","avatar_url":"https://github.com/r48n34.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 💡 Chinese Commercial Code Convertor\n\nSimple Typescript code for convert Chinese Commercial Code.\n\n- 💪🏼 Support both `CN` and `TW` standard\n- 💼 Zero dependency\n- 👔 Tested works on `Node.js`, `React` and other web applications\n\n\u003ca href=\"https://www.npmjs.com/package/chinese-commercial-code-convertor\"\u003e \u003cimg src=\"https://img.shields.io/npm/v/chinese-commercial-code-convertor\" /\u003e \u003c/a\u003e\n\u003ca href=\"https://github.com/r48n34/chinese-commercial-code-convertor\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/r48n34/chinese-commercial-code-convertor/test.yml\" /\u003e\u003c/a\u003e\n\n## 💻 Install \n```bash\nnpm i chinese-commercial-code-convertor\nyarn add chinese-commercial-code-convertor\n```\n\n## 🛠️ Usage\n```ts\nimport { numberToCode, codeToNumber } from \"chinese-commercial-code-convertor\"\n\n// Convert Number To Chinese Code\nconsole.log(numberToCode(1234)); // \"姹\"\nconsole.log(numberToCode(36, {lang: \"tw\"})); // \"久\", Will auto convert 36 to 0036\n\nconsole.log(numberToCode(\"0155\")); // \"作\"\nconsole.log(numberToCode(\"0123 0123 0155\")); // \"伋伋作\"\nconsole.log(numberToCode([\"0144\", \"0155\"])); // 低作\"\nconsole.log(numberToCode([144, 155])); // 低作\"\n\n// Convert Chinese Code To Number\nconsole.log(codeToNumber(\"姹\")) // \"1234\"\nconsole.log(codeToNumber(\"低作\")) // \"0144 0155\"\n\nconsole.log(codeToNumber([\"低\", \"作\"])) // \"0144 0155\"\nconsole.log(codeToNumber([\"低\", \"劝\", \"作\"])) // \"0144 -1 0155\"\n```\n\n## Utils\n\n### `numberToCode()`\nConvert your number input to chinese string.\n```ts\nnumberToCode(\n    input: string | number | number[] | string[],\n    inputOptions?: Options,\n): string \n```\n\n### `codeToNumber()`\nConvert your chinese string input to number string.\n```ts\ncodeToNumber(\n    input: string | string[],\n    inputOptions?: Options,\n): string\n```\n\n### Options\nThe Option input is a object which included the following items:\n```ts\ninterface Options {\n    // Default: \"tw\"\n    lang?: \"tw\" | \"cn\";\n    \n    // Default at numberToCode: \"\"\n    // Default at codeToNumber: \"-1\"\n    notFoundReturn?: string; \n}\n```\n\n#### `lang`\nThe lang is refer to which `Chinese Commercial Code` standard you prefer to return.\n\n- tw: Taiwan - 台灣標準電報碼\n- cn: China - 大陆标准电报码\n- Default: `\"tw\"`\n\n`Code Samples`\n```ts\nnumberToCode(1234, { lang: \"cn\" }) // \"姹\"\ncodeToNumber(\"咥\", { lang: \"cn\" }) // \"8134\"\n```\n\n#### `notFoundReturn`\nIf you target code is not found in the list, the `notFoundReturn` string will be the return string. You can input your own `notFoundReturn`.\n\n- Default at numberToCode: `\"\"`\n- Default at codeToNumber: `\"-1\"`\n\n`Code Samples`\n```ts\nnumberToCode(\"8260\", { notFoundReturn: \"*\" }) // *\ncodeToNumber(\"低劝作\", { notFoundReturn: \"?\" }) // \"0144 ? 0155\"\n```\n\n## 💻 Dev logs\n\n### - 1.1.0\n1. Allow `codeToNumber()` to input split string.\n\n### - 1.0.0\n1. Project init\n\n## 🔐 License\nMIT License\n\n## 📜 References\nhttps://www.njstar.com/cms/chinese-commercial-telegraph-code-lookup","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr48n34%2Fchinese-commercial-code-convertor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr48n34%2Fchinese-commercial-code-convertor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr48n34%2Fchinese-commercial-code-convertor/lists"}