{"id":18627289,"url":"https://github.com/itsnickbarry/phonewords","last_synced_at":"2025-08-30T09:36:33.047Z","repository":{"id":57323138,"uuid":"164962804","full_name":"ItsNickBarry/phonewords","owner":"ItsNickBarry","description":"Two-way number-letter conversion, as inferred by telephones ☎️","archived":false,"fork":false,"pushed_at":"2025-01-05T16:24:53.000Z","size":93,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T09:12:46.217Z","etag":null,"topics":["number","numbers","phone","words","wow"],"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/ItsNickBarry.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-10T00:54:16.000Z","updated_at":"2025-01-05T16:24:54.000Z","dependencies_parsed_at":"2024-07-13T11:30:53.183Z","dependency_job_id":"6891460f-13a0-40fa-b066-396b1fca66bb","html_url":"https://github.com/ItsNickBarry/phonewords","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fphonewords","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fphonewords/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fphonewords/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsNickBarry%2Fphonewords/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItsNickBarry","download_url":"https://codeload.github.com/ItsNickBarry/phonewords/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248347455,"owners_count":21088655,"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":["number","numbers","phone","words","wow"],"created_at":"2024-11-07T04:41:50.895Z","updated_at":"2025-04-11T05:31:33.814Z","avatar_url":"https://github.com/ItsNickBarry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phonewords\n\nTwo-way number-letter conversion as found on most phone dialers, according to [ITU-T E.161](https://en.wikipedia.org/wiki/E.161).\n\n## Usage\n\nInstall the library:\n\n```\nnpm install --save phonewords\n```\n\nRequire the module and call one of its functions, depending on the desired direction of conversion:\n\n```javascript\nlet phonewords = require('phonewords');\n```\n\n### Words to Numbers\n\nConvert a string to a number with `phonewords.wordsToNumbers`.\n\nSpaces and special characters are removed from the input.  Numerals are left unchanged.\n\n```javascript\nphonewords.wordsToNumbers('phonewords');\n// =\u003e '7466396737'\n\nphonewords.wordsToNumbers('pHoNewoRDs');\n// =\u003e '7466396737'\n\nphonewords.wordsToNumbers('P H O N E W O R D S');\n// =\u003e '7466396737'\n\nphonewords.wordsToNumbers('ph0new0rd5');\n// =\u003e '7406390735'\n\nphonewords.wordsToNumbers('!@#$%^\u0026*()');\n// =\u003e ''\n```\n\n### Numbers to Words\n\nConvert a number to an array of possible character combinations with `phonewords.numbersToWords`.\n\nBecause `0` and `1` do no correspond to any characters, they are not replaced.\n\n```javascript\nphonewords.numbersToWords(2);\n// =\u003e [ 'A', 'B', 'C' ]\n\nphonewords.numbersToWords('2');\n// =\u003e [ 'A', 'B', 'C' ]\n\nphonewords.numbersToWords(22);\n// =\u003e [ 'AA', 'AB', 'AC', 'BA', 'BB', 'BC', 'CA', 'CB', 'CC' ]\n\nphonewords.numbersToWords(210);\n// =\u003e [ 'A10', 'B10', 'C10' ]\n\nphonewords.numbersToWords('+1 (201) ...');\n// =\u003e [ '1A01', '1B01', '1C01' ]\n```\n\nThe maximum input length is constrained such that the number of results must not exceed `Math.pow(2, 32) - 1`, the maximum size of an array.  For inputs composed entirely of 3-character digits, this length is `20`.  For inputs composed entirely of 4-character digits, this length is `15`.  Inputs which exceed these constraints will cause the function to throw an error.\n\n```javascript\nphonewords.numbersToWords('2'.repeat(21));\n// =\u003e RangeError: Invalid array length\n\nphonewords.numbersToWords('7'.repeat(16));\n// =\u003e RangeError: Invalid array length\n```\n\n#### Lazy Loading\n\nBy default, this function has a quadratic time and memory complexity.\n\nTo avoid any issues this may cause, particularly when the output is to be streamed or paginated, set the second argument, `lazy`, to `true`.  This will cause the function to return an array `Proxy` that will only calculate each result when its index is explicitly accessed.  The `length` property is overridden to allow iterations over the object to exceed the normal `Array` length limit of `Math.pow(2, 32) - 1`.  Some `Array` functions will break the functionality of the `Proxy`; therefore, only direct indexing and the use of the `length` property are supported.\n\n```javascript\nlet result = phonewords.numbersToWords('2'.repeat(20), true);\n\nresult;\n// =\u003e [ \u003c3486784401 empty items\u003e ]\n\nresult[0];\n// =\u003e 'AAAAAAAAAAAAAAAAAAAA'\n\nresult;\n// =\u003e [ 'AAAAAAAAAAAAAAAAAAAA', \u003c3486784400 empty items\u003e ]\n```\n\nThe maximum input length is constrained such that the number of results must not exceed `Number.MAX_SAFE_INTEGER`.  For inputs composed entirely of 3-character digits, this length is `33`.  For inputs composed entirely of 4-character digits, this length is `26`.  Inputs which exceed these constraints will cause the function to throw an error.\n\n```javascript\nphonewords.numbersToWords('2'.repeat(33), true);\n// =\u003e [ \u003c5559060566555523 empty items\u003e ]\n\nphonewords.numbersToWords('7'.repeat(26), true);\n// =\u003e [ \u003c4503599627370496 empty items\u003e ]\n\nphonewords.numbersToWords('2'.repeat(34), true);\n// =\u003e RangeError: Invalid array length\n\nphonewords.numbersToWords('7'.repeat(27), true);\n// =\u003e RangeError: Invalid array length\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsnickbarry%2Fphonewords","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsnickbarry%2Fphonewords","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsnickbarry%2Fphonewords/lists"}