{"id":29013999,"url":"https://github.com/tomchen/convnum","last_synced_at":"2026-01-20T17:32:05.111Z","repository":{"id":300801285,"uuid":"1007240461","full_name":"tomchen/convnum","owner":"tomchen","description":"TypeScript/JavaScript utility library for converting between various number representations, numeral systems, date/time formats, and more. Includes validation and type detection capabilities","archived":false,"fork":false,"pushed_at":"2025-06-23T17:44:56.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-23T17:49:44.455Z","etag":null,"topics":["conversion","convert","date","javascript","language","npm-package","number","numeral","numerical","ordinal","sequence","transform","typescript","utils"],"latest_commit_sha":null,"homepage":"https://convnum.tomchen.org/","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/tomchen.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-06-23T17:18:19.000Z","updated_at":"2025-06-23T17:44:59.000Z","dependencies_parsed_at":"2025-06-23T17:49:48.426Z","dependency_job_id":"efdcec1a-bbd8-4d7a-b0b6-7ac34ca4fad8","html_url":"https://github.com/tomchen/convnum","commit_stats":null,"previous_names":["tomchen/convnum"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tomchen/convnum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fconvnum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fconvnum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fconvnum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fconvnum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomchen","download_url":"https://codeload.github.com/tomchen/convnum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomchen%2Fconvnum/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261906846,"owners_count":23228355,"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":["conversion","convert","date","javascript","language","npm-package","number","numeral","numerical","ordinal","sequence","transform","typescript","utils"],"created_at":"2025-06-25T20:12:35.740Z","updated_at":"2026-01-20T17:32:05.083Z","avatar_url":"https://github.com/tomchen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConvNum: TypeScript/JavaScript Utility Library for Converting Between Number Representations and Numeral Systems\n\nA comprehensive TypeScript utility library for converting between various number representations, numeral systems, date/time formats, and more. Includes validation and type detection capabilities.\n\n[![npm package](https://img.shields.io/badge/npm%20i-convnum-brightgreen)](https://www.npmjs.com/package/convnum) [![version number](https://img.shields.io/npm/v/convnum?color=green\u0026label=version)](https://www.npmjs.com/package/convnum?activeTab=versions) [![Actions Status](https://github.com/tomchen/convnum/workflows/Test/badge.svg)](https://github.com/tomchen/convnum/actions) [![License](https://img.shields.io/github/license/tomchen/convnum)](https://github.com/tomchen/convnum/blob/main/LICENSE) [![Documentation](https://img.shields.io/badge/Documentation-blue)](https://convnum.tomchen.org)\n\n## Installation\n\n```bash\nnpm install convnum\n```\n\n## Usage\n\n```typescript\nimport { toEnglishWords, fromChineseWords } from 'convnum'\n\nconsole.log(toEnglishWords(12345)) // 'twelve thousand three hundred forty-five'\nconsole.log(fromChineseWords('一万二千三百四十五')) // 12345\n```\n\nDetailed documentation is available at [https://convnum.tomchen.org](https://convnum.tomchen.org).\n\n## Supported Types\n\nThe library supports conversion and detection of the following number representation types:\n\n(`NumType` is a type used in this library to identify different number representations)\n\n| Name                     | NumType                     | Examples                            | Notes                                                                                                                                                                                                  |\n| ------------------------ | --------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| Decimal                  | `decimal`                   | \"123\", \"456\"                        | Standard base-10 numbers                                                                                                                                                                               |\n| Latin letters            | `latin_letter`              | \"A\", \"b\", \"Z\"                       | Standard Latin alphabet                                                                                                                                                                                |\n| Month                    | `month_name`                | \"January\", \"JAN\", \"february\", \"Feb\" | Month names in various languages supported for conversion via [`Intl`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). Only English is supported for detection |\n| Day of week              | `day_of_week`               | \"Monday\", \"MON\", \"tuesday\", \"Tue\"   | Day names in various languages supported for conversion via [`Intl`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl). Only English is supported for detection   |\n| Roman numerals           | `roman`                     | \"VI\", \"vi\", \"MMMCMXCIX\"             | Roman numeral system (range: 1-3999). Does not support single Unicode character form like \"Ⅵ\"                                                                                                          |\n| Arabic numerals          | `arabic`                    | \"٠\", \"١\", \"٢\"                       | Eastern Arabic numerals                                                                                                                                                                                |\n| English cardinal         | `english_cardinal`          | \"1st\", \"2Nd\", \"3RD\"                 | Ordinal numbers with suffixes                                                                                                                                                                          |\n| English words            | `english_words`             | \"one hundred twenty-three\", \"thReE\" | Written English numbers                                                                                                                                                                                |\n| French words             | `french_words`              | \"cent vingt-trois\", \"TroIs\"         | Written French numbers (currently supports traditional writing like \"cent vingt-trois\", not \"cent-vingt-trois\")                                                                                        |\n| Chinese words            | `chinese_words`             | \"一万三千零二\", \"一萬三千零二\"      | Standard Chinese numerals (simplified and traditional Chinese)                                                                                                                                         |\n| Chinese financial        | `chinese_financial`         | \"壹万叁仟零贰\", \"壹萬叄仟零貳\"      | Traditional financial characters (simplified and traditional Chinese)                                                                                                                                  |\n| Binary                   | `binary`                    | \"1010\", \"0B1101\"                    | Base-2 numbers (0-1 only)                                                                                                                                                                              |\n| Octal                    | `octal`                     | \"123\", \"0o456\"                      | Base-8 numbers (0-7 only)                                                                                                                                                                              |\n| Hexadecimal              | `hexadecimal`               | \"1A\", \"abc\", \"0xFF\"                 | Base-16 numbers (0-9, A-F)                                                                                                                                                                             |\n| Greek letters            | `greek_letter`              | \"Α\", \"α\", \"Ω\"                       | Greek alphabet                                                                                                                                                                                         |\n| Greek letter names       | `greek_letter_english_name` | \"Alpha\", \"BETA\", \"gamma\"            | English names of Greek letters (Alpha, Beta, Gamma, etc.)                                                                                                                                              |\n| Cyrillic letters         | `cyrillic_letter`           | \"А\", \"а\", \"Я\"                       | Cyrillic alphabet                                                                                                                                                                                      |\n| Hebrew letters           | `hebrew_letter`             | \"א\", \"ב\", \"ת\"                       | Hebrew alphabet (22 standard letters, no upper/lower case distinction; no Final Forms)                                                                                                                 |\n| Chinese Heavenly Stems   | `chinese_heavenly_stem`     | \"甲\", \"乙\", \"丙\"                    | 天干 (Tiān Gān) (always same character in simplified and traditional Chinese)                                                                                                                          |\n| Chinese Earthly Branches | `chinese_earthly_branch`    | \"子\", \"丑\", \"寅\"                    | 地支 (Dì Zhī) (always same character in simplified and traditional Chinese)                                                                                                                            |\n| Chinese Solar Terms      | `chinese_solar_term`        | \"立春\", \"惊蛰\", \"驚蟄\"              | 节气 (Jié Qì) (simplified and traditional Chinese)                                                                                                                                                     |\n| Astrological signs       | `astrological_sign`         | \"Aries\", \"tauRuS\"                   | Zodiac signs                                                                                                                                                                                           |\n| NATO phonetic            | `nato_phonetic`             | \"Alfa\", \"alpha\", \"braVo\", \"Charlie\" | NATO phonetic alphabet                                                                                                                                                                                 |\n\n**Special types:**\n| Name | NumType | Examples | Notes |\n|------|---------|----------|-------|\n| Invalid | `invalid` | `null`, `undefined` | Any non-string inputs (type errors) |\n| Empty | `empty` | `\"\"`, `\"   \"` | Empty or whitespace-only strings |\n| Unknown | `unknown` | \"xyz\", \"!@#$\" | Non-empty strings that don't match any type |\n\n**Note:**\n\n- [Julian day](https://en.wikipedia.org/wiki/Julian_day) is supported only for conversion, not for detection, and is therefore not included in the `NumType` type.\n- `parseDateString` and `formatDateString` are date functions, not number representations and not included in the `NumType` type. The two functions are used for precise parsing and formatting of date strings.\n\n## Features\n\n- **Conversion, validation, and detection** functions for all supported types\n- **Robust error handling** for invalid or unexpected inputs\n- **Thorough test coverage**, including edge cases and uncommon scenarios\n- **Full support for:**\n  - Zero, negative values, large numbers (up to quintillions), and other edge cases\n  - Multiple locales and number formats\n  - Simplified ⇄ Traditional Chinese conversion (limited to characters used in this library)\n  - Case-insensitive input across all functions\n  - Zero runtime dependencies\n  - Tree-shakable builds (when using specific functions — not the all-in-one version — with ES modules and a proper bundler)\n\n## Release Notes\n\n### 0.1.0\n\n- Initial release\n\n### 0.2.0\n\n- Date functions\n- Detailed typeInfo\n- Base prefix (e.g. \"0x01\", \"0b01\", \"0o01\")\n- Circular support\n\n### 0.2.1\n\n- Simplify ParseDateResult interface\n\n### 0.2.3\n\n- Out-of-range circular support for all types in `convertTo`\n- Export version\n\n### 0.2.4\n\n- Add year-month only support (months property to DateInterpretation and formatMonthString function)\n\n### 0.2.5\n\n- parseDateString correctly returns all possible DateInterpretation\n- Fix nonexistent YDM\n- Add non-year-month support (days property to DateInterpretation and formatDayString function)\n- Traditional Chinese support\n- getTypes and parseDateString's result ordering and compare functions\n\n### 0.2.6\n\n- Add Greek letter English name and Hebrew letter support\n\n### 0.2.7\n\n- anyToNumber function\n- convertFrom and convertTo's 2nd parameter can be string of type\n\n## To-do\n\n- Add (0-padded) digit count info to TypeInfo for decimal, octal, hexadecimal and binary\n- Loose matching for French and English words\n- _Maybe not in this lib: braille and morse code support_\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fconvnum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomchen%2Fconvnum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomchen%2Fconvnum/lists"}